gpt4 book ai didi

oracle - ORA-01799 : a column may not be outer-joined to a subquery

转载 作者:行者123 更新时间:2023-12-03 10:54:33 34 4
gpt4 key购买 nike

这是我的查询

SELECT 
COUNT(C.SETID)
FROM
MYCUSTOMER C
LEFT OUTER JOIN MYCUSTOPTION CO
ON
(C.SETID = CO.SETID
AND C.CUST_ID = CO.CUST_ID
AND CO.effdt = (
SELECT MAX(COI.EFFDT)
FROM MYCUSTOPTION COI
WHERE
COI.SETID = CO.SETID
AND COI.CUST_ID = CO.CUST_ID
AND COI.EFFDT <=SYSDATE
)
)

这是我收到的错误消息..

enter image description here

我究竟做错了什么???

最佳答案

您可以通过推送子查询来重写它,使其不是外部连接:

select Count(C.setid)
from mycustomer C
left outer join (select *
from mycustoption co
where co.effdt <= (select Max(COI.effdt)
from mycustoption COI
where COI.setid = co.setid
and COI.cust_id = co.cust_id
and COI.effdt <= sysdate)) co
on ( C.setid = CO.setid
and C.cust_id = CO.cust_id )

关于oracle - ORA-01799 : a column may not be outer-joined to a subquery,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14571254/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com