ORACLE FULL OUTER JOIN 的 bug
gemwo 2003-06-11 05:16:11 两张表如下:
TEST1:
id1
--
A
B
C
TEST2:
id2
--
A
A
D
D
第二张表使用group子查询后,再用外连接,结果第二张group by没有执行也没有COUNT数据
SELECT * FROM
TEST1
full outer join
(SELECT id2,COUNT(*) FROM test WHERE id1 IS NOT NULL GROUP BY id2)
ON id1=id2
ID ID1 COUNT(*)
--------- -------------- ------
A A 2
C
B
D
D
如果改用right outer join 则是正确的
SELECT * FROM
TEST1
right outer join
(SELECT id2,COUNT(*) FROM test WHERE id1 IS NOT NULL GROUP BY id2)
ON id1=id2
ID ID1 COUNT(*)
----------------------
A A 2
D 2
各位看看是oracle的bug还是sql有问题