Nick

Fri 3 Jun 2005 13:30:43
Fri 3 Jun 2005 13:30:43
Hi All,
I have a problem using the LIMIT statement in MySQL. Basically I want to limit results to a number such as 200. However, this works fine except it returns the *first* 200 records it finds. What I want is the *last* 200 records because I need to examine the latest records.
here's an example of how the query looks now:
SELECT recordid FROM allRecords WHERE userID = $uID ORDER BY recordid LIMIT 0, 200
What do I need to change/add to make it pull the latest records and not the first 200?
Thanks,
Nick
I have a problem using the LIMIT statement in MySQL. Basically I want to limit results to a number such as 200. However, this works fine except it returns the *first* 200 records it finds. What I want is the *last* 200 records because I need to examine the latest records.
here's an example of how the query looks now:
SELECT recordid FROM allRecords WHERE userID = $uID ORDER BY recordid LIMIT 0, 200
What do I need to change/add to make it pull the latest records and not the first 200?
Thanks,
Nick
Administrator

Fri 3 Jun 2005 13:37:39
Fri 3 Jun 2005 13:37:39
In your SELECT query you could use DESC for sorting lastest record like this
SELECT recordid FROM allRecords WHERE userID = $uID ORDER BY recordid DESC LIMIT 200

















