I am implementing pagination using SQL limit in MySQL db.Records
are needed to get
retrieved from the last row backwards. There are several thousands records in table
and I want to retrieve say 500 records at a time to show up in a page.
SELECT * FROM tbl_name ORDER BY some_col DESC
will retrieve all records.
But I do not want all records, as they are thousands in number.
If I use
SELECT * FROM tbl_name ORDER BY some_col DESC LIMIT 500
it will return last 500 records in descending order.
but I could not find a way to retrieve next block of 500 in reverse direction, starting from a point where first block have left up.