create database tb_demo create table tb_test ( id int identity(1,1) primary key, name varchar(100), old int, createtime datetime ) insert into tb_test(name,old) values('aaa',34) insert into tb_test(name,old) values('bbb',23) insert into tb_test(name,old) values('ccc',1) insert into tb_test(name,old) values('aaa',23) insert into tb_test(name,old) values('aaa',3) select * from tb_test select * from tb_test where name in (select name from tb_test group by name having count(name)> 1)
转载于:https://www.cnblogs.com/jecyyu/archive/2012/06/13/2548058.html