从深层嵌套的mySQL查询中选择多个列

时间:2013-09-03 07:15:11

标签: mysql

select 
    a 
from 
    table_1 
where 
    b in ( 
       select 
           c 
       from 
           table_c 
       where 
           d in ( 
              select 
                 e 
              from 
                 table_e 
           )
      );

我想在最终结果中传递'd'....任何方式?

1 个答案:

答案 0 :(得分:1)

您需要使用JOIN

select 
    a ,
    d
from 
    table_1 
inner join table_c
    ON b = c
inner join table_e
    ON d = e