标签:span nbsp group by where class 函数 math group user
group by和order by
分组后的字段要么是分组字段或聚合函数
where和having区别:
where:在分组之前进行限定;后面不能跟聚合函数的判断
having:在分组之后进行限定,如果不满足结果就不会显示出来;后面可以跟聚合函数判断
select user_name from t_user group by user_name order by id
select sex,avg(math) ,count(id) ID from student group by sex having ID>2; --ID是别名
标签:span nbsp group by where class 函数 math group user
原文地址:https://www.cnblogs.com/Difcipo/p/14016906.html