我有3个表A B和C.我想首先处理表A和B以创建表'AB'然后将结果连接到C.这是我的想法:
select C.number, C.class, AB.name
from C,
(select A.name, A.number
from A
FULL OUTER JOIN B
ON A.number = B.number) AB
FULL OUTER JOIN AB
ON AB.number = C.number
然而它似乎没有起作用。现在我不确定A& B的结果是否可以在Oracle DB中使用别名。该如何以正确的方式完成?
答案 0 :(得分:1)
SELECT C.number,
C.class,
AB.name
FROM C
FULL OUTER JOIN
(SELECT A.name,
A.number
FROM A
FULL OUTER JOIN B
ON A.number = B.number) AB
ON AB.number = C.number