日期:2014-05-18  浏览次数:20471 次

查询某一字段相同记录超过两条的记录
Id Name
1 a1
2 b2
2 b3
3 c4
3 c5
3 c6
4 d7

查询结果得出:

Id Name
2 b2
2 b3
3 c4
3 c5
3 c6


------解决方案--------------------
SQL code
select a.*
from yourTable a , (select id from yourTable group by id having count(*)>1) b
where a.id=b.id