sql查询表中字段值相同的数据记录

来源:互联网 发布:海鹰数据速卖通 编辑:程序博客网 时间:2024/05/07 05:56

表T中有字段id,name,age(注:id有相同值)   查询id相同且大于1的数据记录

select * from T a where exists (select id from T where id=a.id group by id having count(*)>1)

原创粉丝点击