0

Hi People

I would like to get an sql statement that uses LIMIT and OFFSET and then sorts the results in ASC or DESC order through the user of ORDER BY, something like this:

SELECT * FROM table LIMIT 10 OFFSET 0 ORDER BY DESC

Note: that does not work so any ideas? I tried shuffling around order by to avial.

Thanks, Regards X

Edited by OmniX: n/a

3
Contributors
2
Replies
10
Views
7 Years
Discussion Span
Last Post by rajabhaskar525
1
SELECT * FROM table order by 1 DESC LIMIT 10 OFFSET 0

order by goes before limit and offset. also, i'm using 1 for the first field.

Votes + Comments
Thanks for the help!
0

Hi People

I would like to get an sql statement that uses LIMIT and OFFSET and then sorts the results in ASC or DESC order through the user of ORDER BY, something like this:

SELECT * FROM table LIMIT 10 OFFSET 0 ORDER BY DESC

Note: that does not work so any ideas? I tried shuffling around order by to avial.

Thanks, Regards X

SELECT * FROM table order by primarykey DESC LIMIT 10 OFFSET 0

orderby goes before limit and start

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.