输入banner图图片脚本导航/分类

mysql 分组、聚集

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