select a.B,a.D from x a, x b where a.B=b.B and a.D=b.D
select * from table1 t where (select count(1) from table1 where b=t.b and d=b.d)>1
select a.* from x a inner join x b on a.b = b.b and a.d=b.d
select * from x where b in (select b from x) and d in (select d from x)
declare @t table(id int, B int, C int, D int) insert @t select 0, 2, 3, 4 insert @t select 1, 6, 7, 8 insert @t select 2, 2, 8, 4 select * from @t t where exists(select 1 from @t where B=t.B and D=t.D and ID<>t.ID )
select * from test a, test b where a.B=b.B and a.D=b.D and a.ID<>b.ID
select * from table_Pqs Pqs where Exists(select 1 from table_Pqs where b=Pqs.b and d=Pqs.d And id<>table_Pqs.id)
--如果想直接排列出顺序,便于查看就加上排序 select * from table_Pqs Pqs where Exists(select 1 from table_Pqs where b=Pqs.b and d=Pqs.d And id<>table_Pqs.id) Order By b,d--如果作为一条记录显示 那就如上用inner join方式,但就结果而言应该是反复出现了2次
select a.B,a.D from x a, x b where a.B=b.B and a.D=b.D
insert @t select 0, 2, 3, 4
insert @t select 1, 6, 7, 8
insert @t select 2, 2, 8, 4
select * from @t t where exists(select 1 from @t where B=t.B and D=t.D and ID<>t.ID )
where Exists(select 1 from table_Pqs
where b=Pqs.b and d=Pqs.d And id<>table_Pqs.id)
--如果想直接排列出顺序,便于查看就加上排序
select * from table_Pqs Pqs
where Exists(select 1 from table_Pqs
where b=Pqs.b and d=Pqs.d And id<>table_Pqs.id)
Order By b,d--如果作为一条记录显示 那就如上用inner join方式,但就结果而言应该是反复出现了2次
select a.B,a.D from x a, x b where a.B=b.B and a.D=b.D