Hi Brian,
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!
This should work:
DELETE FROM tbl ORDER BY ts DESC LIMIT 100, 999999;
Note that ORDER BY and LIMIT are a MySQL-extensions to DELETE, not part
of the SQL standards.
Regards,
Jeremy
--
Jeremy Cole
MySQL Geek, Yahoo! Inc.
Desk: 408 349 5104
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]