with tmp(Name) as(
select '张三' union all
select '张三' union all
select '李四' union all
select '王五' union all
select '王五' union all
select '王五' union all
select '赵六' union all
select '赵六')
select count(*) from (
select Name from tmp group by Name having count(*)>1
) t
结果为:
select name,count(*) from table_name group by name having count(*)>1;
select count(name) ,name from table group by name having count(name)>1