Need last 100 records...
Is there a nifty way to select just that last 100 records with MySQL? In Oracle I use Maxrows and date to accomplish this. Can¹t seem to figure this out with MySQL. Please advise! Thank you! Mark
Re: Need last 100 records...
Mark S Lowe wrote: Is there a nifty way to select just that last 100 records with MySQL? In Oracle I use Maxrows and date to accomplish this. Can¹t seem to figure this out with MySQL. Please advise! Thank you! Mark SELECT * FROM SOME_TABLE ORDER BY SOME_KEY LIMIT 0,100 Van -- = Linux rocks!!! http://www.dedserius.com/ = - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: Need last 100 records...
Use Limit is one way On 6/25/02 12:19 PM, Mark S Lowe [EMAIL PROTECTED] wrote: Is there a nifty way to select just that last 100 records with MySQL? In Oracle I use Maxrows and date to accomplish this. Can¹t seem to figure this out with MySQL. Please advise! Thank you! Mark - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: Need last 100 records...
SELECT * from table ORDER BY column DESC, LIMIT 100 This will get the last 100 in descending order. If you have a date field you can use a WHERE clause with ORDER BY date field with the LIMIT parameter to achieve an ascending order. I hope this helps. Pat... - Original Message - From: Mark S Lowe [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, June 25, 2002 12:19 PM Subject: Need last 100 records... Is there a nifty way to select just that last 100 records with MySQL? In Oracle I use Maxrows and date to accomplish this. Can¹t seem to figure this out with MySQL. Please advise! Thank you! Mark - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: Need last 100 records...
In the last episode (Jun 25), Mark S Lowe said: Is there a nifty way to select just that last 100 records with MySQL? In Oracle I use Maxrows and date to accomplish this. Can?t seem to figure this out with MySQL. You mean select the 100 most-recently-inserted records ? SELECT * FROM table ORDER BY timestampfield DESC LIMIT 100; -- Dan Nelson [EMAIL PROTECTED] - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: Need last 100 records...
ORDER BY whatever DESC LIMIT 100 Mark S Lowe wrote: Is there a nifty way to select just that last 100 records with MySQL? In Oracle I use Maxrows and date to accomplish this. Can¹t seem to figure this out with MySQL. Please advise! Thank you! Mark - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php