Suppose I have a table with columns:
a CHAR, b Int, c Int
Column a only has entries of x/y/z, and the values in b and c go from 1 to 10.
Then I do:
select a, c
from mytable
where b > 5
What would I have to do from here to get a table of 3 rows (one for each letter), and the average c value for each of x, y and z?
Are you looking for group by
?
select a, avg(c)
from t
where b > 5
group by a;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.