| | |
Selecting the 3 latest entries in a table
Please support our MySQL advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
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.
MySQL Syntax (Toggle Plain Text)
SELECT someColumn FROM someTable ORDER BY someColumn DESC LIMIT 3
Last edited by hollystyles; Jan 15th, 2008 at 4:46 am.
![]() |
Other Threads in the MySQL Forum
- Previous Thread: Pulling a portion of text from a MySQL table
- Next Thread: SQL Update Script
| Thread Tools | Search this Thread |
Tag cloud for MySQL
"use" 1 agplv3 alfresco amazon api artisticlicense aws bizspark changingprices communityjournalism contentmanagement contractors copyright count crm data database design developer development distinct drupal dui ec2 eliminate email enter enterprise error facebook form foss gartner gnu government gpl greenit groklaw groupware hiring hyperic images innerjoins insert ip join journalism keyword kickfire laptop legal license licensing linux maintenance mariadb matchingcolumns metron micromanage microsoft microsoftexchange mindtouch montywidenius mozilla multiple mysql mysqlcolumnupdating mysqldatetimeordermax() mysqlinternalqueries mysqlquery mysqlsearch news open-xchange opendatabasealliance opengovernment opensource operand oracle pdf penelope php priceupdating query referencedesign remove saas search select sharepoint simpledb sourcecode spotify sql statement sugarcrm techsupport thunderbird update virtualization






