Select a.code,a.name,b.Image from table1 a left join table2 b on a.code=b.code left join table3 c on a.code=c.code where c.type='A'

解决方案 »

  1.   

    或:Select a.code,a.name,b.Image from table1 a left join table2 b on a.code=b.code where a.code in (select code from table3 where type='A')
      

  2.   

    Select a.code,a.[name],IsNull(b.[image],'') from table1 a
    left join table2 b on a.code = b.code 
    where a.code in (select code from table3 where type = 'A')
      

  3.   

    to  pengdali(大力 V3.0) 
      Select a.code,a.name,b.Image from table1 a left join table2 b on a.code=b.code left join table3 c on a.code=c.code where c.type='A'
      这句好像有问题,结果中会有重复记录。Select a.code,a.name,b.Image from table1 a left join table2 b on a.code=b.code where a.code in (select code from table3 where type='A')
    这句是正确的。
      

  4.   

    select a.code,a.name,b.Image 
    from table1 a left join table2 b
    on a.code=b.code
    where
    a.code in (select code from table3 where type='A')