现在有3张表 tableA,tableB,tableC.
tableC是tableB的子表.tableC里面有字段和tableA关联,tableB只能和tableC关联.
我要已tableA做主表左外连tableB表同时tableBtableC是内联的.

解决方案 »

  1.   

    select ...
    from tableA a left join tableB b on a.关联字段=b.关联字段
                    left join tableC c on b.关联字段=c.关联字段
    where ...
      

  2.   

    a和B表无关联字段
    a和c有关联,b和c有关联。
      

  3.   

    用with来控制连接顺序试试.
    with t as (select 字段列表 from b , c where 条件)
    select 字段列表 from a left join t on 条件.
      

  4.   


    select ...
    from tableA a left join (select *
                             from tableB b left join tableC c on b.关联字段=c.关联字段
                                ) d
                  on a.关联字段=d.关联字段 --这里d.关联字段就是c表中与a表关联的字段
    where ...