【问题标题】:Filter order when joining two tables连接两个表时的过滤顺序
【发布时间】:2020-09-02 06:25:08
【问题描述】:

我在下面有一个查询,它根据自我加入为我提供了该员工的员工和经理,

select e.name as employeename, m.name as managername
from employee e
left join employee m
on e.mgr_id = m.emp_id
where e.doj < m.doj

我知道当左加入第一个要加入的表时,必须在 where 子句中过滤,第二个在 on,我会在这里做什么,因为过滤器包含两个表,或者在另一个例子中,它不是自连接的,它是连接的在 2 个不同的表上,但过滤器包含两个表?谢谢

【问题讨论】:

    标签: sql presto


    【解决方案1】:

    你可以在 e.doj

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-11-14
      • 2020-01-07
      • 1970-01-01
      • 2021-11-19
      • 2017-11-30
      • 2019-04-08
      • 2015-08-29
      • 1970-01-01
      相关资源
      最近更新 更多