[英]Oracle left outer join query
select a,last_note_user,c,d,iso_src
from X,Y,Z
left outer join W
ON (W.last_note_user=Z.userid AND W.user_ten=Y.iso_src)
when I am executing the above query it is giving me the error "Y.iso_src" is a invalid identifier
.However, Y.iso_src
is a valid identifier and it exist in the system table. 当我执行上面的查询时,它给出了错误
"Y.iso_src" is a invalid identifier
但是, Y.iso_src
是一个有效的标识符,它存在于系统表中。 Is something wrong with the above left outer join?? 上面的左外连接有问题吗? Please help me out!!!
请帮帮我!!!
You cannot mix JOIN
syntaxes in Oracle
this way. 您不能以这种方式在
Oracle
混合使用JOIN
语法。
A JOIN
condition can only refer tables previously joined using ANSI JOIN
syntax. JOIN
条件只能引用先前使用ANSI JOIN
语法连接的表。
Use this: 用这个:
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
It's probably a good habit to not mix ANSI and non-ANSI join syntax as the other responses indicate. 如其他响应所示,不混合ANSI和非ANSI连接语法可能是一个好习惯。 However, it is technically possible, by isolating the non-ANSI joins into a subquery:
但是,通过将非ANSI连接隔离到子查询中,技术上是可行的:
create table X as (select dummy a, dummy c, dummy d from dual);
create table Y as (select dummy iso_src from dual);
create table Z as (select dummy userid from dual);
create table W as (select dummy last_note_user, dummy user_ten from dual);
select a,last_note_user,c,d,iso_src
from (select a, c, d, iso_src, userid FROM X,Y,Z) xyz
left outer join W
ON (W.last_note_user=xyz.userid AND W.user_ten=xyz.iso_src);
A LAST_NOTE_USER C D ISO_SRC
- -------------- - - -------
X X X X X
1 rows selected
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.