select * from table2
where
 exists(select * from table1 
  where 
    table1.filed1 = 1 and table2.filed1 = table1.field0 and
    table1.filed1 = 2 and table2.filed2 = table1.field0 and
    table1.filed1 = 3 and table2.filed3 = table1.field0
  )

解决方案 »

  1.   

    select table2.* from table2 inner join table1 on table1.field(0)=table2.field(0) where (table1.field(1)=1 and field(0)=table2.field(1)) 
    or (table1.field(1)=2 and field(0)=table2.field(2)) 
    or (table1.field(1)=3 and field(0)=table2.field(3))
      

  2.   

    不对不对,
    select * from table2
    where
    exists(select * from table1 
      where 
        table1.filed1 = 1 and table2.filed1 = table1.field0 or
        table1.filed1 = 2 and table2.filed2 = table1.field0 or
        table1.filed1 = 3 and table2.filed3 = table1.field0
      )  
    其他的先不探讨,但这两个AND一定要改成OR
     
      

  3.   

    windindance(风之舞)你的where子句中条件自相矛盾
    是不是应该这样
    select * from table2
    where
    exists(select * from table1 
      where 
        (table1.filed1 = 1 and table2.filed1 = table1.field0) or
        (table1.filed1 = 2 and table2.filed2 = table1.field0) or
        (table1.filed1 = 3 and table2.filed3 = table1.field0)
      ) 
      

  4.   

    关于SQL Server 的阅报和发布,请帮忙。
    http://www.csdn.net/expert/topic/461/461023.shtm 
      

  5.   

    请注意我在贴子中写的"AND",那是个"与"条件,不是连字符.