declare @tb table(id int, xx int,yy int) insert into @tb select 1,2,1 union all select 2,2,2 union all select 3,5,8 union all select 6,3,5select * from @tb where yy in(1,2) select * from @tb where yy=1 or yy=2
select * from 表 where 字段B=1 AND 字段B=
select * from 表 where 字段B=1 or 字段B=2
select A.外键 from (select * from 表 where 字段B=1) as A, (select * from 表 where 字段B=2) as B where A.外键=B.外键
insert into @tb select 1,2,1
union all
select 2,2,2
union all
select 3,5,8
union all
select 6,3,5select * from @tb where yy in(1,2)
select * from @tb where yy=1 or yy=2
from (select *
from 表
where 字段B=1) as A,
(select *
from 表
where 字段B=2) as B
where A.外键=B.外键