Table has a date(timestamp) field which is indexed. As it is a log records are naturally in date order.
I want to get the last ten records but keep them in date order, i.e.
SELECT * FROM table ORDER BY date Desc LIMIT 10;
Gets me the 10 records I want but in the wrong order and I have to sort post query.
I would normally use SQL like:
SELECT BOTTOM 10 * FROM table ORDER BY date;
but mySQL does not support TOP or BOTTOM
Any ideas?
Thanks,
Cris
I want to get the last ten records but keep them in date order, i.e.
SELECT * FROM table ORDER BY date Desc LIMIT 10;
Gets me the 10 records I want but in the wrong order and I have to sort post query.
I would normally use SQL like:
SELECT BOTTOM 10 * FROM table ORDER BY date;
but mySQL does not support TOP or BOTTOM
Any ideas?
Thanks,
Cris