我正在尝试执行SQL语句,但是我收到一条错误,指出连接中存在语法错误。
我正在执行以下查询:
SELECT x.CM_LINES
,t1.SRC_NET
,t1.DST_NET
,t1.SRC_NETZONE
,t1.DST_NETZONE
,t1.RPA
,t1.RPN
FROM CCP.comms_matrix_data t1
JOIN (
SELECT to_char(RTRIM(XMLAGG(XMLELEMENT(e, cml.TEXT, ',').EXTRACT('//text()')).GetClobVal(), ',')) CM_LINES
,src_net
,dst_net
FROM (
SELECT DISTINCT to_char(cmline) TEXT
,src_net
,dst_net
FROM CCP.comms_matrix_data
WHERE comms_matrix_id = :pkid
ORDER BY cmline
) cml
join cml ON cml.src_net = t1.SRC_NET
AND cml.dst_net = t1.DST_NET
WHERE t1.COMMS_MATRIX_ID = :pkid
AND LOWER(t1.STATUS) LIKE '%implement%'
GROUP BY src_net
,dst_net
) x /* should there not be an on clause here? */
GROUP BY x.CM_LINES /* error here */
,t1.SRC_NET
,t1.DST_NET
,t1.SRC_NETZONE
,t1.DST_NETZONE
,t1.RPA
,t1.RPN;
我已经测试过错误是否在JOIN中,但事实并非如此。如果我单独执行SELECT,它们就可以正常工作并给我正确的结果。
任何帮助将不胜感激!