是否可以在ON-Statement中使用表别名?
SQL语句:
SELECT XMLELEMENT("row", XMLATTRIBUTES(rownum as "order"),
(
SELECT
XMLAGG(XMLELEMENT("attribute",XMLATTRIBUTES(z as "identifier") ) )
FROM b
LEFT JOIN c
ON c.ID = b.cID
AND c.example = table_alias.example
)
)
FROM
(
SELECT example FROM x ORDER BY y
) table_alias
我收到table_alias.example
是无效标识符的错误。
如果我将c.example = table_alias.example
移动到WHERE语句中它可以工作,但当然我会得到错误的结果。
有人有想法吗?
TY frgtv10
答案 0 :(得分:-1)
试试这个
SELECT XMLELEMENT("row", XMLATTRIBUTES(rownum as "order"),
( SELECT XMLAGG(XMLELEMENT("attribute"),XMLATTRIBUTES(z as "identifier") ) )
FROM b, c, x
where c.ID = b.cID(+) AND c.example = x.example
)
) from dual