数据源:
想要根据姓名分组,并且统计,分组数量大于1的分组数量。..
select name,count(*) from xxx group by name HAVING count(*)>1
select sum(case when count(*) >1 then 1 else 0 end)分组大于1的数量 from table_name a group by a.name;
select name,count(*) from table group by name HAVING count(*)>1;
参考自:MySQL如何优化GROUP BY http://www.data.5helpyou.com/article237.html
select name,count(*) from 表名 group by name HAVING count(*)>1;
select name,count(name) group by name having count(name)>1
select count(name) from table group by name having count(name)>1