在SQL Server 2012中,我使用了实际查询的简化版本。从“容器”表中选择数据时,它在查找谓词中具有标量运算符。
标称运算符在此查找谓词中的用途是什么?
CREATE TABLE #EligibleOrders (OrderID INT PRIMARY KEY,
StatusCD CHAR(3),
CreatedOnDate DATETIME
)
--insert logic into #EligibleOrders
--Final Query
SELECT T2.OrderID ,olic.LineItemID,
SUM(c.quantity) AS ShippedQty,
COUNT(DISTINCT c.ContainerID) AS ShippedCases
FROM #EligibleOrders T2
INNER JOIN dbo.OrderLineItemContainers (NOLOCK) AS olic
ON olic.OrderID = T2.OrderID
INNER JOIN dbo.Containers (NOLOCK) AS c
ON olic.Containerid = c.Containerid
GROUP BY T2.OrderID ,olic.LineitemID
OPTION (MAXDOP 1)
执行计划
寻求谓词