select post from employee group by post; # 只能取分组的字段 #聚合函数 max min avg sum count #每个职位有多少个员工 select post,count(id) from employee group by post; select post,count(id) as emp_count from employee group by post; select post,max(salary) as emp_count from employee group by post; select post,min(salary) as emp_count from employee group by post; select post,avg(salary) as emp_count from employee group by post; select post,sum(age) as emp_count from employee group by post; select post,group_concat(id,name) from employee group by post;
原文:https://www.cnblogs.com/zhujing666/p/12313774.html