当前位置:Gxlcms > 数据库问题 > mysql 分组、聚集

mysql 分组、聚集

时间:2021-07-01 10:21:17 帮助过:30人阅读

count(*)

select count(distinct a) 计算不同的a的数量

 

 

分组

除了聚集函数外,select 中使用的表达式,必须出现在group by中,不能使用别名

所有的null将被分为一组

 

having支持所有where的操作符

 

 

select name, count(*) from t

group by name

having count(*) >= 2

 

having count(distinct a)>2 a的种类大于2

 

mysql 分组、聚集

标签:mysq   忽略   where   统计   聚集   不能   大于   group by   from   

人气教程排行