USE MyDB
SELECT ItemID, Price, DiscountAmount,ItemPrice - DiscountAmount AS TotalCost
FROM MyItems
WHERE TotalCost > 500
ORDER BY TotalCost DESC;
Let's say I have a query and like above. 'TotalCost' is a calculated field generated by the item price and discount amount. When I try to use this in the WHERE and ORDER BY statements, I get an error saying it is not a valid column. Is there a way to do this
without repeating my expression?
Go to the complete details ...