您的位置:首页 > 其它

查询表里面有N组相同的记录经典SQL语句

2007-02-28 18:40 337 查看
表里面有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)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: