i have a table with id: 1,2,3,4,5,6,7,8,9,10, this query:

SELECT id FROM table ORDER BY id ASC LIMIT 0,5

responds correctly: 1,2,3,4,5.

Now I want to go back, so the new query:

SELECT id FROM table ORDER BY id DESC LIMIT 4,5

responds: 10,9,8,7,6 instead of: 5,4,3,2,1

Seems that the LIMIT clause works fine only from the first record onwards, unfortunately the code returns last record position only (4) how do you go back?

Thanks at all.

1 Answers

0
M.Hemant On

Try this,

SELECT id FROM test ORDER BY id DESC LIMIT 5,5

Output:

5,4,3,2,1

demo