我是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
重写此查询,并且不确定它会是什么样的?
答案 0 :(得分:1)
连接的列就在加号之前。
... FROM CustomerShip s LEFT OUTER JOIN (....) i ON s.ShipSeq = i.ShipSeq