try this:

delete from mytable
where id not in ( select id from mytable order by id desc limit n )


On 4/7/07, Eric S. Johansson <[EMAIL PROTECTED]> wrote:

what is the easiest way to hold on to the last N records and delete all
older?  I can't figure out the right where expression.





--
--
The PixAddixImage Collector suite:
http://groups-beta.google.com/group/pixaddix

SqliteImporter and SqliteReplicator: Command line utilities for Sqlite
http://www.reddawn.net/~jsprenkl/Sqlite

Cthulhu Bucks!
http://www.cthulhubucks.com

Reply via email to