select a.pzh,a.gfdm,a.xfdm,a.note,b1.mc,b2.mc
from a,b b1,b b2
where a.gfdm=b1.dm and a.gfdm=b2.dm

解决方案 »

  1.   

    上面的条件写错了:
    select a.pzh,a.gfdm,a.xfdm,a.note,b1.mc,b2.mc
    from a,b b1,b b2
    where a.gfdm=b1.dm and a.xfdm=b2.dm
      

  2.   

    select a.*,b.mc from a,b
    where a.xfdm=b.dm
      

  3.   

    select 
        a.pzh,a.gfdm,a.xfdm,a.note,b1.mc,b2.mc
    from 
        A,B b1,B b2
    where
        A.gfdm = b1.dm and A.xfdm = b2.dm
      

  4.   

    select A.pzh,A.gfdm,A.xfdm,A.note,b1.mc,b2.mc
    from A left Outer Join B b1 On A.gfdm = b1.dm
           left Outer Join B b2 On A.gfdm = b2.dm
      

  5.   

    select a.*,(select mc from b where dm =  a.gfdm),(select mc from b where dm = a.xfdm) from  a
      

  6.   

    SELECT 
       a.pzh,a.gfdm,a.xfdm,a.note,b1.mc,b2.mc
    FROM 
       a,b b1,b b2
    WHERE
       a.gfdm=b1.dm and a.xfdm=b2.dm