Hi guys and gals

Just curious to know if it's possible to select the 3 latest entries in a table. Would be an added bonus to my project.

;)

Recommended Answers

All 2 Replies

Use the LIMIT keyword (Similar to TOP in MSSQL) If you use ORDER BY to order the results descending, so that the latest records will be at the top of the result set. Then use LIMIT to get just the first three of those records.

SELECT someColumn 
FROM someTable 
ORDER BY someColumn DESC 
LIMIT 3
commented: Very informative response. Helped a lot! +1

Thanks hollystyles. That worked perfectly ;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.