Re: [sqlite] last N records

2007-04-09 Thread Eric S. Johansson

Dennis Cote wrote:

Eric S. Johansson 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.


--- eric


Eric,

I posted some sample code to use a table as FIFO (last N records) to the 
list a while ago. See 
http://article.gmane.org/gmane.comp.db.sqlite.general/16175/match=fifo 
for details.


thanks Dennis.  That looks interesting.

---eric


--
Speech-recognition in use.  It makes mistakes, I correct some.

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] last N records

2007-04-09 Thread Dennis Cote

Eric S. Johansson 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.


--- eric


Eric,

I posted some sample code to use a table as FIFO (last N records) to the 
list a while ago. See 
http://article.gmane.org/gmane.comp.db.sqlite.general/16175/match=fifo 
for details.


HTH
Dennis Cote

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] last N records

2007-04-07 Thread Jay Sprenkle

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