Simple query question
Posted: Tue Nov 15, 2005 3:24 am
How do i select 20 records, those that are added last to the database?
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
SELECT * FROM table ORDER BY record DESC LIMIT 20It's ASC. ASC = ascending = increasing; DESC = decending = decreasing.jayshields wrote:Supposing you've got an auto incrementing record as an ID in your DB or a date for each DB entry, change the field for 'record'. I don't know if it's ASC or DESC without trying it myself, I always get confused.Code: Select all
SELECT * FROM table ORDER BY record DESC LIMIT 20
HTH somehow though