问题
We're trying to run an outer join between table A on both tables B and C but get the error:
ORA-01417: a table may be outer joined to at most one other table
How can we get this to work?
Query:
select a.xxx, a.yyy, b.col1, c.col1 from a, b, c
where
a.xxx = b.xxx (+) and
a.yyy = b.yyy (+) and
a.xxx = c.xxx (+) and
a.yyy = c.yyy (+)
回答1:
Please refrain from using comma in the from clause and use the JOIN clause instead.
Try using this:
select a.xxx, a.yyy, b.col1, c.col1
from a LEFT JOIN b ON a.xxx = b.xxx AND a.yyy = b.yyy
LEFT JOIN c ON a.xxx = c.xxx AND a.yyy = c.yyy
回答2:
Use proper explicit join
syntax. I think the following is probably what you want to do:
select a.xxx, a.yyy, b.col1, c.col1
from a left join
b
on a.xxx = b.xxx and a.yyy = b.yyy left join
c
on a.xxx = c.xxx and a.yyy = c.yyy;
回答3:
You could try:
select a.xxx, y.xxx, b.col1, c.col2
from a
left join b on a.xxx = b.xxx and a.yyy = b.yyy
left join c on a.xxx = c.xxx and a.yyy = c.yyy
来源:https://stackoverflow.com/questions/34303534/outer-join-between-three-tables-causing-oracle-ora-01417-error