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

后端 未结 6 1765
渐次进展
渐次进展 2021-01-03 20:23

Here is my query

SELECT 
    COUNT(C.SETID)
FROM 
    MYCUSTOMER C
    LEFT OUTER JOIN MYCUSTOPTION CO 
    ON 
        (C.SETID = CO.SETID 
            AND          


        
6条回答
  •  [愿得一人]
    2021-01-03 20:49

    you can rewrite that by pushing the sub query so that its not outer joined:

    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 ) 
    

提交回复
热议问题