select * from table2,table1 where table1.f1=a and table1.f2=b and table2.f3=table1.f3 and table2.f4=table1.f4

解决方案 »

  1.   

    我想我的意思也许没有表达明白
    比如table1   f1  f2  f3  f4
    --------------------
      1   1   4    1
      2   3   5    1
    talbe2
      f3  f4  f5   f6
    --------------------
      4   1    2    3
      3   5    1    2在给定f1=1,f2=1的时候,从table1中找出f3=4,f4=1
    然后依据f3,f4从table2中找到f5=2,f6=3
     yiyizq0260(yiyizq
      我正在试验你的方法
      

  2.   

    万变不离其中,也许直接用a.f3=b.f3 and a.f4=b.f4是效率最高的。select a.*,b.f3,b.f4,b.f5,b.f6,b.f7 
    from table1 a ,table2 b
    where
    a.f3=b.f3 and
    a.f4=b.f4