【问题标题】:What is the left and right table for joins after the first join in SQL(postgresql?SQL中第一次join后join的左右表是什么(postgresql?
【发布时间】:2022-01-07 07:33:46
【问题描述】:

我想知道,第一次join后的左表和右表是什么。

例如:

From final_productions fp
             left join things.pc p on fp.production_id = p.id
             left join events.time t on fp.tx_id = t.id
             left join things.car c on c.id = fp.channel_id
             right join events.form f on f.production_id = p.id
             left join events.trigger_alert ta on mc.cue_sheet_id = ta.id

我知道对于第一个左连接inner join things.pc p on fp.production_id = p.id,左表将是from statement 中的表,即final_productions。但是其他连接(即第一个连接语句之后的连接)呢?有人可以解释一下吗?谢谢

【问题讨论】:

  • 为什么这个问题被否决了?

标签: postgresql join


【解决方案1】:

The documentation 说:

可以在JOIN 子句周围使用括号来控制连接顺序。在没有括号的情况下,JOIN 子句从左到右嵌套。

所以

a LEFT JOIN b RIGHT JOIN c

相同
(a LEFT JOIN b) RIGHT JOIN c

【讨论】:

    猜你喜欢
    • 2011-05-05
    • 1970-01-01
    • 2017-03-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-04-02
    • 2014-02-07
    • 2015-01-06
    相关资源
    最近更新 更多