user393273
user393273

Reputation: 1438

ORDER BY lowest number

I am trying to order by lowest however this sql term below order's by highest number

SELECT * FROM questions ORDER BY question_ref DESC LIMIT 1;

Any help would be appreciated

Upvotes: 1

Views: 500

Answers (4)

faester
faester

Reputation: 15076

Using ascending rather than descending ordering should do the trick: SELECT * FROM questions ORDER BY question_ref ASC LIMIT 1;

Upvotes: 0

user393273
user393273

Reputation: 1438

SELECT * FROM questions ORDER BY question_ref ASC LIMIT 1;

Upvotes: 0

TuteC
TuteC

Reputation: 4382

Make it ASC: SELECT * FROM questions ORDER BY question_ref ASC LIMIT 1;

Or: SELECT MIN(question_ref) FROM questions;

Upvotes: 3

eykanal
eykanal

Reputation: 27017

Use ASC instead of DESC:

SELECT * FROM questions ORDER BY question_ref ASC LIMIT 1;

Upvotes: 1

Related Questions