söndagen den 6 november 2005 16:15 skrev Brian Dunning:
> I'd like to delete all but the newest 100 records from a table. I
> have a timestamp field. I can't figure out how to do this in a single
> SQL statement - can anyone help? Thanks!

I'd try something like this:

delete from x where ID not in (select ID from x order by timestamp desc limit 
100);

Björn Persson

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to