declare @t table(a int,b varchar(10),c int,d int,e int)
insert into @t select 1001 , 'ac' , 10 , 20 , 30
union all select 1001 ,'ac' , 20 , 20 , 40
union all select 1002 ,'ac' , 20 , 30 , 50
union all select 1003 ,'bc' , 20 , 30 , 80
union all select 1004 , 'ad' , 10 , 20 , 30
union all select 1004 , 'ad' , 20 , 20 , 40
select a.* from @t a,(select a,b from @t group by a,b having count(*)>1) b where a.a=b.a and a.b=b.b
insert into @t select 1001 , 'ac' , 10 , 20 , 30
union all select 1001 ,'ac' , 20 , 20 , 40
union all select 1002 ,'ac' , 20 , 30 , 50
union all select 1003 ,'bc' , 20 , 30 , 80
union all select 1004 , 'ad' , 10 , 20 , 30
union all select 1004 , 'ad' , 20 , 20 , 40
select a.* from @t a,(select a,b from @t group by a,b having count(*)>1) b where a.a=b.a and a.b=b.b
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货