MySQL查询数据GROUP BY和ORDER BY

MySQL的查询计数非常简单,通过 COUNT ... GROUP BY 可以对指定字段进行计数,为了方便排序, COUNT 字段应该有一个 alias :

统计字段数量,并且进行排讯
select alert,count(*) as num from notifier_alert_statistics group by alert order by num DESC;

参考