日期:2014-05-18 浏览次数:20583 次
同意楼上 select A from [tableName] group by A having count(1) > 1
------解决方案--------------------
楼上正解
A,B字段没有重复的吧?
------解决方案--------------------
create table tb(A int , B varchar(10)) insert into tb select 1, 'a' insert into tb select 2 , 'b' insert into tb select 2 , 'c' insert into tb select 3 , 'd' insert into tb select 4 , 'd' insert into tb select 5 , 'd' insert into tb select 5 , 'c' select * from tb where a in (select A from tb group by A having count(b) > 1)
------解决方案--------------------
select * from t
where A in (select A from t group by A having count(1)>1)