mysql offset from bottom 1

mysql offset from bottom

SELECT id FROM table ORDER BY id DESC LIMIT 5

If you like to select entries 10,9,[8,7,6,5,4],.. try (3 start index, 5 row count)

SELECT id FROM table ORDER BY id DESC LIMIT 3,5
Or 1,2,3,[4,5,6,7,8],9,10

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

Here is what the above code is Doing:
1. The first query is selecting the last 5 entries from the table.
2. The second query is selecting the entries from the 3rd row to the 7th row.
3. The third query is selecting the entries from the 4th row to the 8th row.

Similar Posts