Re: Really dumb question... deleting everything but newest 100 rows?
| From: | Marco Tabini | Date: | Sat, 23 Nov 2002 22:41:13 +0000 |
| Subject: | Re: Really dumb question... deleting everything but newest 100 rows? | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-23616@lists.php.net to get a copy of this message | ||
If you have a column that gives you the "newness" of each row--I'm
assuming a date here:
delete from my_table order by date_inserted desc limit 100, -1
This should work... I recommend a db backup first :-)
Marco
------------
php|architect - The magazine for PHP Professionals
The monthly worldwide magazine dedicated to PHP programmers
Check us out on the web at http://www.phparch.com
On Sat, 2002-11-23 at 17:38, Leif K-Brooks wrote:
> I know this is a dumb question, but how would I delete everything but
> the first 100 results returned from a query? I know I'd use limit, but
> my mind's going blank as to the exact syntax.
>
> --
> The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt
> it will be prosecuted to the full extent of the law.
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>