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

表里面有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)

你可能感兴趣的:(sql)