简体   繁体   English

Oracle在3个表上进行外部联接

[英]Oracle outer join on 3 tables

If I have two tables (A and B) that are joined on col 'id' and i want to get all records from A regardless of a corresponding record in B, I know I can do: 如果我有两个表(A和B)在col'id'上联接,并且我想从A获取所有记录,而不管B中的对应记录如何,我知道我可以做到:

select * from A left outer join B on A.id = B.id;

Now I have 3 tables A,B,CA is joined to B and B is joined to C. I want all records from A irrespective of whether there is a record in B or C. So should I write select * from A left outer join B on A.id = B.id and (....now what do I write here) even using old syntax, I am stuck: select * from A,B,C where A.id = B.id(+) and B.id1 = C.id1(+) (Somehow this does not seem right) 现在我有3个表A,B,CA连接到B,B连接到C。我想要A中的所有记录,而不管B或C中是否有记录。所以我应该select * from A left outer join B on A.id = B.id andselect * from A left outer join B on A.id = B.id and (....现在我在这里写什么)即使使用旧语法,我也被困住了: select * from A,B,C where A.id = B.id(+) and B.id1 = C.id1(+) (以某种方式似乎不正确)

select * 
from A 
   left outer join B on A.id = B.id
   left outer join C on C.id = B.id

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM