select  外键  from 表 where  字段B=1 or 字段B=2 

解决方案 »

  1.   

    select  外键  from 表 where  字段B in(1,2)
      

  2.   

    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
      

  3.   

    select *  from 表 where  字段B=1 AND 字段B=
      

  4.   

    select *  from 表 where  字段B=1 or 字段B=2
      

  5.   

    select A.外键
    from (select *
    from  表
    where 字段B=1) as A,
    (select *
    from 表
    where 字段B=2) as B
    where A.外键=B.外键