Without a view (but with a trigger) and certainly open to improvement (9 is the MAX_ENTRIES parameter):
CREATE TABLE "log" ( "id" INTEGER NOT NULL PRIMARY KEY ON CONFLICT REPLACE AUTOINCREMENT, "seq" INTEGER CONSTRAINT "ix1Seq" UNIQUE ON CONFLICT REPLACE, "data" CHAR); CREATE TRIGGER "trInsLog" AFTER INSERT ON "log" BEGIN update log set seq = id % 9 where id=(select max(id) from log); END; insert into log (data) values ('a'); insert into log (data) values ('b'); insert into log (data) values ('c'); insert into log (data) values ('d'); insert into log (data) values ('e'); insert into log (data) values ('f'); insert into log (data) values ('g'); insert into log (data) values ('h'); insert into log (data) values ('i'); insert into log (data) values ('j'); insert into log (data) values ('k'); insert into log (data) values ('l'); insert into log (data) values ('m'); insert into log (data) values ('o'); insert into log (data) values ('p'); insert into log (data) values ('q'); insert into log (data) values ('r'); insert into log (data) values ('s'); insert into log (data) values ('t'); insert into log (data) values ('u'); insert into log (data) values ('v'); insert into log (data) values ('w'); insert into log (data) values ('x'); insert into log (data) values ('y'); insert into log (data) values ('z'); insert into log (data) values ('Here you are!'); _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users