Oracle外连接(+)语法

时间:2017-06-13 10:58:42

标签: sql oracle

我是SQL的新手,也是Oracle的初学者,并且很难理解(+)语法。请考虑以下查询:

SELECT *
FROM   CustomerShip,
    (SELECT DISTINCT b.ShipSeq AS shipSeq
     FROM   Orders a,
            CustomerShip b
     WHERE  a.OrderId IN (SELECT OrderId
                          FROM   Orders
                          WHERE  CustomerId = @CustomerId
                          AND    OrderType <> 'A')
     AND    b.CustomerId = @CustomerId
     AND    b.ShipSeq = a.CustShip
     AND    OrderStatus <> 'C'
     GROUP BY b.ShipSeq) i
WHERE  CustomerId = @CustomerId
AND    (Address NOT LIKE '%RETAIL%STORE%')
AND    ShipSeq = i.ShipSeq(+)
ORDER BY ShipTo DESC, OrderDate DESC;

所以我收集Oracle中的(+)是outer join,但我很困惑加入的是什么?内部查询i的结果。我需要为MSSQL重写此查询,并且不确定它会是什么样的?

1 个答案:

答案 0 :(得分:1)

连接的列就在加号之前。

 ... FROM CustomerShip s LEFT OUTER JOIN (....) i ON s.ShipSeq = i.ShipSeq