三个表之间的外连接导致 Oracle ORA-01417 错误 [英] Outer join between three tables causing Oracle ORA-01417 error

查看:294
本文介绍了三个表之间的外连接导致 Oracle ORA-01417 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在尝试在表 B 和表 C 上的表 A 之间运行外连接,但出现错误:

We're trying to run an outer join between table A on both tables B and C but get the error:

ORA-01417: 一个表最多可以外部连接到另一个表

ORA-01417: a table may be outer joined to at most one other table

我们怎样才能让它发挥作用?

How can we get this to work?

查询:

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 (+) 

推荐答案

请不要在 from 子句中使用逗号,而使用 JOIN 子句.

Please refrain from using comma in the from clause and use the JOIN clause instead.

试试这个:

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 

这篇关于三个表之间的外连接导致 Oracle ORA-01417 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆