我们已经在SQL Server以下查询:将SQL Server查询到Oracle外连接问题
SELECT b.columnB,
b.displayed_name AS displayName,
c.type_cd,
c.type_desc,
b.month_desc AS month
FROM table1 a, table2 b, table3 c
WHERE b.region_code *= a.columnA
AND c.program_type_cd *= a.program_type_cd
其中,在Oracle中,得到了转化为:
SELECT b.columnB,
b.displayed_name displayName,
c.type_cd,
c.type_desc,
b.month_desc month
FROM table1 a,
table2 b,
table3 c
WHERE b.columnB = a.columnA(+)
AND c.type_cd = a.type_cd(+)
不过,虽然在运行Oracle本我们得到一个错误
"a table must be outer joined to at most one other table"
最好的方法来解决这个问题,并保持与SQL服务器相同的逻辑?
如果* =和LEFT JOIN做同样的事情,那么我将def去LEFT JOIN。这就是为什么我讨厌编程中的注释。谢谢 – Omnipresent 2009-10-15 18:00:40
其实我不认为这跟原来的查询是一样的:原来是从b到a的左连接,同时从c到a,这就是为什么Oracle抱怨的原因。重写的查询是从a到b和a到c的左连接,原始查询中原本应该= =而不是* =。 – 2009-10-17 06:27:10
那么应该如何写入oracle呢? – Omnipresent 2009-10-20 02:31:14