方案1: select code from a where code in (select code from b) and code in (select code from c) and code in (select code from d)
方案2: select code from a where code in ( select b.code from b,c,d where b.code=c.code and b.code=d.code)
方案3: select code from a where code in ( select t1.code from (select b.code from b) t1 inner join (select c.code from c) t2 on t1.code=t2.code inner join (select d.code from d) t3 on t1.code=t3.code )
请教下三个方案的优缺点及执行流程。
------解决方案--------------------
SQL code
select a.code
from a join (select b.code from b,c,d where b.code=c.code and b.code=d.code) t
on a.code = t.code
------解决方案--------------------
SQL code
select distinct a.code from a,b,c,d where a.code=b.code and b.code=c.code and b.code=d.code
------解决方案--------------------
SQL code
select a.*
from a
inner join b on a.code=b.code
inner join c on a.code=c.code
inner join d on a.code=d.code
------解决方案--------------------