8 group by 约束条件
Posted zhujing666
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了8 group by 约束条件相关的知识,希望对你有一定的参考价值。
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;
以上是关于8 group by 约束条件的主要内容,如果未能解决你的问题,请参考以下文章
r - 使用 group_by 和 mutate 根据多个条件添加新列时出现意外的“=”