【发布时间】:2017-10-09 21:46:01
【问题描述】:
如何在colum1 中仅选择一行 最高 值,同时确保所选colum1 值大于n
SELECT * FROM thetable WHERE colum1 >= 150 ORDER BY amount LIMIT 1
//using limit to get 1 row
//using where to fulfill greathe-than criteria
//using order by to sort and get max one.
上面的查询给出了大于150行但不是表的最大值,查询有什么问题?
【问题讨论】:
-
你需要
ORDER BY amount DESC。
标签: mysql sql-order-by limit