Note that there are some explanatory texts on larger screens.

plurals
  1. POOracle SQL outer join on multiple columns -miscoding
    primarykey
    data
    text
    <p>According to <a href="http://www.orafaq.com/node/855" rel="nofollow">http://www.orafaq.com/node/855</a> The record in that table for "Incomplete Join Trail"</p> <p>Wrong way of coding is:</p> <pre><code>select * from T1, T2, T3, T4 where T1.C1 = T2.C1(+) and T2.C2 = T3.C2(+) and T3.C3 = T4.C3; </code></pre> <p>Right way of coding is:</p> <pre><code>select * from T1, T2, T3, T4 where T1.C1 = T2.C1(+) and T2.C2 = T3.C2(+) and T3.C3 = T4.C3(+); </code></pre> <p>This I couldn't understand. There is a possibility that I might want to do a equi-join T3 &amp; T4 and outer join between the other tables. Why is the author saying it is incorrect?</p> <p>According to <a href="http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:5229892958977" rel="nofollow">http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:5229892958977</a>,</p> <p>Tom is using the following example in his answer which seems similar to the "Incomplete Join Trail" example listed above,</p> <pre><code>select * from t1,t2,t3 where t1.x = t2.x and t2.y = t3.y(+); </code></pre> <p>Could anyone help me understand this?</p> <p>Edit:</p> <p>Please correct me if I am wrong. As per Allan's answer, the following code would be correct:</p> <pre><code>select * from T1, T2, T3, T4 where T3.C3 = T4.C3 and T1.C1 = T2.C1(+) and T2.C2 = T3.C2(+); </code></pre> <p>If the above is correct, will it be equivalent to the following quoted answer?.[ie., Can we do this in oracle's sql without the subquery in the quoted answer?]</p> <pre><code>SELECT * FROM t1, t2, (SELECT * FROM t3, t4 WHERE t3.c3 = t4.c3) t3_4 WHERE t1.c1 = t2.c1(+) AND t2.c2 = t3_4.c2(+); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload