或: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')
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')
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') 这句是正确的。
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')
left join table2 b on a.code = b.code
where a.code in (select code from table3 where type = 'A')
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')
这句是正确的。
from table1 a left join table2 b
on a.code=b.code
where
a.code in (select code from table3 where type='A')