查询某一字段相同记录超过两条的记录
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) bwhere a.id=b.id