ORDER BY最小数字

时间:2011-05-08 19:31:56

标签: php mysql sql

我试图按最低顺序排序,但这个sql术语低于最高数量的订单

SELECT * FROM questions ORDER BY question_ref DESC LIMIT 1;

任何帮助将不胜感激

4 个答案:

答案 0 :(得分:3)

将其设为ASC:SELECT * FROM questions ORDER BY question_ref ASC LIMIT 1;

或者:SELECT MIN(question_ref) FROM questions;

答案 1 :(得分:1)

使用ASC代替DESC

SELECT * FROM questions ORDER BY question_ref ASC LIMIT 1;

答案 2 :(得分:0)

SELECT * FROM questions ORDER BY question_ref ASC LIMIT 1;

答案 3 :(得分:0)

使用升序而不是降序排序应该可以解决问题: SELECT * FROM questions ORDER BY question_ref ASC LIMIT 1;