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 1 DESC LIMIT 10 OFFSET 0

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

commented: Thanks for the help! +2

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.