WITH B AS (
SELECT X.ID, SUBSTR(RTRIM(XMLAGG(XMLELEMENT(E, X.COMMENTS || '//') ORDER BY X.ID, X.DATE desc ).EXTRACT('//text()').GETCLOBVAL(), '//'), 1, 32767) AS COMMENTS
FROM X
GROUP BY X.ID
)
SELECT A.ID, B.User, B.Comments
from A
left join B on A.ID = B.ID
我在A.ID和B.User上有价值,但在B.Comments上却没有。当我只在B内部运行时,它就没有价值,而它才有价值。
如果连接不正确,则B.User也应该为空,但它具有价值。很奇怪,但是应该有理由吧?谁能帮助我了解此查询的内容并提供一些提示?
谢谢!