Go homepage(回首页)
Upload pictures (上传图片)
Write articles (发文字帖)

The author:(作者)归海一刀
published in(发表于) 2014/2/3 6:46:29
查询表里面有N组相同的记录经典SQL语句_[SQL Server教程]

查询表里面有N组相同的记录经典SQL语句_[SQL Server教程]

表里面有N条相同的记录,要查出来.


如:
ID Name
12 d
34 e
543 t
34 e
12 d
45 y
543 t

查询的结果应为:
ID Name
12 d
12 d
34 e
34 e
543 t
543 t


假如表名为Table03,可以用下面语句轻松实现:


select id,name from table03 where name in(select name from table03 group by name having count(name)>1)







If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)





QQ:154298438
QQ:417480759