如何使用'+'运算符在ORACLE中执行FULL OUTER JOIN? [英] How to perform FULL OUTER JOIN in ORACLE using '+' operator?

查看:84
本文介绍了如何使用'+'运算符在ORACLE中执行FULL OUTER JOIN?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不使用FULL OUTER JOIN或FULL JOIN之类的关键字,而是如何在'+'运算符的帮助下使用'where'子句执行完全外部联接?!

Instead of using keywords like FULL OUTER JOIN or FULL JOIN, how can I perform full outer join using 'where' clause with the help of '+' operator?!

推荐答案

您不能(至少直接这样做). Oracle仅支持使用SQL:1999语法的完全外部联接.

You can't (at least directly). Oracle only supports a full outer join using SQL:1999 syntax.

您可以通过合并两个外部联接来伪造它:

You can fake it by unioning two outer joins:

select a.field1, b.field2
from table_a a, table_b b
where a.id = b.id(+)
union all 
select a.field1, b.field2
from table_a a, table b b
where a.id(+) = b.id
      and a.id is null

使用SQL:1999语法更具可读性:

It's a lot more readable using the SQL:1999 syntax:

select a.field1, b.field2
from table_a a full outer join table_b b
on a.id = b.id

这篇关于如何使用'+'运算符在ORACLE中执行FULL OUTER JOIN?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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