日期:2014-05-18 浏览次数:20442 次
select count(*) from (select name from student group by name having count(*)>1)
------解决方案--------------------
Student表(ID,Name),其中Name有部分重复,ID是作为Key的,现在要你用SQL语句统计Name中有重复的Name个数(相同的Name只记一次)(ID为整型,Name为字符串型)。例如:
1 A
2 B
3 C
4 A
5 A
6 C
7 D
8 E
9 B
则有重复的为A,B,C共三个。
select name , count(*) cnt from tb group by name having count(*) > 1