[英]Oracle Left outer join
SELECT
a,
last_note_user,
c,
d,
iso_src
FROM
X
CROSS JOIN Y
CROSS JOIN Z
LEFT OUTER JOIN W
ON W.last_note_user = Z.userid
AND W.user_ten = Y.iso_src
The above ANSI code fetch me 107 records,When I giving the same query without ANSI code it is fetching 875 records.The non ANSI query is below: 上面的ANSI代码获取了107条记录,当我给出没有ANSI代码的相同查询时,它获取了875条记录。非ANSI查询如下:
SELECT
a,
last_note_user,
c,
d,
iso_src
FROM
X,
Y,
Z,
W
WHERE
W.last_note_user = Z.userid(+)
AND W.user_ten = Y.iso_src(+)
why there is difference in the two query with ANSI and without ANSI standards?? 为什么使用ANSI和不使用ANSI标准的两个查询有区别? By answering the above query please help me out!!!
通过回答以上查询,请帮帮我!!!
Your old-style query has the (+) symbols on the wrong side of the predicate. 您的旧式查询在谓词的错误一侧带有(+)符号。 It should be:
它应该是:
SELECT
a,
last_note_user,
c,
d,
iso_src
FROM
X,
Y,
Z,
W
WHERE
W.last_note_user (+) = Z.userid
AND W.user_ten (+) = Y.iso_src
But I wouldn't use the old-style syntax any more really. 但是我不会再使用老式语法了。
OUTER JOINS with old ANSI-syntax are ambiguous, so who knows what the query optimizer understands with this. 具有旧ANSI语法的OUTER JOINS模棱两可,因此谁知道查询优化器对此有所了解。
If the first SQL is producing the right rows, forget about the ANSI version and move on. 如果第一个SQL产生的行正确,请忽略ANSI版本并继续。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.