简体   繁体   English

Oracle外连接语法

[英]Oracle outer join syntax

I have a query that looks like this: 我有一个查询,看起来像这样:

select *
from find fsc,
        let lf,
        cust cus,
        STRIKE ist
WHERE   fsc.id = lf.id
AND     ist.ID_old = fsc.ID_old
AND     lf.cust_id = cus.cust_id(+)

I know (+) is old syntax for a join, but I am not sure what it is actually doing to this query. 我知道(+)是联接的旧语法,但是我不确定它对该查询的实际作用。 Could someone explain this and show this query without the (+) in the where statement, using more modern join syntax? 有人可以解释一下,并使用更现代的连接语法在where语句中显示不带(+)的查询吗?

I believe you want this: 我相信你想要这样:

select *
from find fsc join
     let lf
     on fsc.id = lf.id join
     STRIKE ist
     on ist.ID_old = fsc.ID_old left join
     cust cus
     on lf.cust_id = cus.cust_id;

To be honest, the outer join is probably not necessary. 老实说,可能不需要外部联接。 Why would lf have a cust_id that is not valid? 为什么lfcust_id无效? The only reasonable possibility is if the value is NULL . 唯一合理的可能性是,如果该值为NULL

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM