【问题标题】:Left outer join on three tables三张表的左外连接
【发布时间】:2014-10-26 17:45:23
【问题描述】:

我需要在三个表上使用左外连接。示例我有三个名为 A、B 和 C 的表。我想要这样的结果 A 左外连接(B 左外连接 c)。 最好的方法是什么。

我写过这样的东西。

select * from A,B,C where A.column_a=B.column_a(+) and B.column_b=C.column_b(+);

【问题讨论】:

  • 为什么不使用left outer join 语法而不是Oracle 特有的(+),因为您似乎知道如何表达它?

标签: oracle outer-join


【解决方案1】:

取决于表格的关联方式(您的问题并不完全清楚),

 select * 
 from A
    left join B on b.column_a = a.column_a
    left join C on c.column_b = b.column_b

或者,

 select * 
 from A
    left join (B left join C on c.column_b = b.column_b)
        on b.column_a = a.column_a

【讨论】:

    猜你喜欢
    • 2016-07-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-02-01
    • 1970-01-01
    • 2012-08-03
    • 2018-11-06
    相关资源
    最近更新 更多