关键字:GROUP BY、HAVING、GROUP_CONCAT、DISTINCT
分组(group by):SELECT group_by_name1, group_by_name2 FROM js_sys_log GROUP BY group_by_name1, group_by_name2
分组(distinct):SELECT DISTINCT group_by_name1, group_by_name2 FROM js_sys_log
分组统计:select group_by_name,COUNT(1) FROM table_name GROUP BY group_by_name
分组统计加条件(having):SELECT log_type,COUNT(1) FROM js_sys_log GROUP BY log_type HAVING COUNT(1) > 7000
分组统计并列出具体信息(group_concat):select group_by_name,COUNT(1), GROUP_CONCAT(column_name) FROM table_name GROUP BY group_by_name
推荐一个前后端脚手架 lg-soar:助力开发者腾飞的利器