我尝试使用SQL Server 2008执行计算列,但在>
附近出现语法错误:
Select
*,
AverageCost = case Quantity
when > 0 then (TotalCost / Quantity)
else null
end
from ProductTable;
眼睛更敏锐的人能告诉我什么是错的吗?
答案 0 :(得分:2)
数量必须在当时
之后Select *, AverageCost =
case when Quantity > 0 then (TotalCost / Quantity) else null end from ProductTable;