當我嘗試執行上SSMS 2012 Express中的以下腳本:SQL Server 2012的SSMS的智能感知「無效列名」在WHERE子句
SELECT ItemID, ItemPrice, DiscountAmount, Quantity,
ItemPrice * Quantity AS PriceTotal,
DiscountAmount * Quantity AS DiscountTotal,
Quantity * (ItemPrice - DiscountAmount) AS ItemTotal
FROM OrderItems
WHERE ItemTotal > 500
ORDER BY ItemTotal DESC
「智能感知」說:「無效的列名」指的是「ItemTotal 「僅在WHERE子句中。如果我註釋掉或刪除WHERE子句,即使在ORDER BY子句中也調用了「ItemTotal」,它仍可以很好地工作。
請幫忙。
很多謝謝。
在Where子句你算算' ItemTotal'。 – Prashant16
檢查我的答案..! –