select * ,(select count(*) from T where 姓名 = a.姓名) from T a where 姓名 in (select 姓名 from tbl group by name having count(name)>1) order by 姓名select * ,(select count(*) from T where 姓名 = a.姓名) from T a where (select count(*) from T where 姓名 = a.姓名) > 1 order by 姓名
--得到所有重复的姓名及重复次数.按重复的顺序排列select 姓名,count(姓名) as 重复次数,count(distinct 姓名) as 重复人数 from 表 group by 姓名 having count(姓名)>0 order by count(姓名)
,(select count(*) from T where 姓名 = a.姓名)
from T a
where 姓名 in (select 姓名
from tbl
group by name
having count(name)>1)
order by 姓名select *
,(select count(*) from T where 姓名 = a.姓名)
from T a
where (select count(*) from T where 姓名 = a.姓名) > 1
order by 姓名
from 表 group by 姓名
having count(姓名)>0
order by count(姓名)