消息 207,级别 16,状态 1,第 1 行无效的列名称 'ItemTotal'
Msg 207, Level 16, State 1, Line 1 Invalid column name 'ItemTotal'
这段代码是我写的。没有我的 WHERE 语句它工作正常。我一直收到错误消息
Msg 207, Level 16, State 1, Line 1 Invalid column name 'ItemTotal'.
我不知道我做错了什么!
SELECT
ItemID,
ItemPrice,
ItemPrice * quantity AS PriceTotal,
DiscountAmount * quantity AS DiscountTotal,
((ItemPrice - DiscountAmount) * quantity) AS ItemTotal
FROM
OrderItems
WHERE ItemTotal > 500;
未提供数据库平台,但根据查询:'ItemTotal' 不是您可以使用的列,因为它是一个别名。您需要过滤实际数据
SELECT
ItemID,
ItemPrice,
ItemPrice * quantity AS PriceTotal,
DiscountAmount * quantity AS DiscountTotal,
((ItemPrice - DiscountAmount) * quantity) AS ItemTotal
FROM
OrderItems
WHERE ((ItemPrice - DiscountAmount) * quantity) > 500;
这段代码是我写的。没有我的 WHERE 语句它工作正常。我一直收到错误消息
Msg 207, Level 16, State 1, Line 1 Invalid column name 'ItemTotal'.
我不知道我做错了什么!
SELECT
ItemID,
ItemPrice,
ItemPrice * quantity AS PriceTotal,
DiscountAmount * quantity AS DiscountTotal,
((ItemPrice - DiscountAmount) * quantity) AS ItemTotal
FROM
OrderItems
WHERE ItemTotal > 500;
未提供数据库平台,但根据查询:'ItemTotal' 不是您可以使用的列,因为它是一个别名。您需要过滤实际数据
SELECT
ItemID,
ItemPrice,
ItemPrice * quantity AS PriceTotal,
DiscountAmount * quantity AS DiscountTotal,
((ItemPrice - DiscountAmount) * quantity) AS ItemTotal
FROM
OrderItems
WHERE ((ItemPrice - DiscountAmount) * quantity) > 500;