0

如果我有下表:

ID  Name   Price  RRP
1   Shirt  10.00  20.00
2   Jeans  15.00  30.00

我将如何检索节省最多的行(ID 2)?

4

2 回答 2

4
Select Id,Name,Price,RRP FROM TableName Order By (RRP-Price) Desc Limit 1
于 2013-10-02T10:11:04.133 回答
1
SELECT ID, Name, Price, RRP, RRP-Price AS saving 
FROM Table 
ORDER BY saving DESC
于 2013-10-02T10:14:28.690 回答