我有一位同事写了以下查询。第一个有效,第二个无效。此外,如果您从子查询中删除聚合函数,它也可以工作。预言机优化器正在做一些奇怪的事情。有什么想法吗?在 SQL Developer 3.1 中针对 11.1.0.6.0 64 位运行。
这有效:
SELECT
a.fd_customer_key
, b.fd_customer_key
, b.counter
FROM FETCH_CUSTOMER a
, (select fd_customer_key, count(*) as counter from fetch_customer_order group by fd_customer_key) b
where a.fd_customer_key = b.fd_customer_key (+)
and b.counter is null
这不会:
SELECT
a.fd_customer_key
, b.fd_customer_key
, b.counter
FROM FETCH_CUSTOMER a
, (select fd_customer_key, count(*) as counter from fetch_customer_order group by fd_customer_key) b
where a.fd_customer_key = b.fd_customer_key (+)
and b.fd_customer_key is null