Hi All, I can't figure out how to delete with offset using groups.
Imagine I have a table create table history(id integer, lastactivity datetime default (datetime('now'))) and I insert values as insert into history (id) values (1) A resulting table might look 1|2013-05-22 07:50:05 1|2013-05-22 07:50:08 1|2013-05-22 07:50:10 1|2013-05-22 07:50:12 2|2013-05-22 07:50:16 1|2013-05-22 07:50:18 2|2013-05-22 07:50:20 2|2013-05-22 07:50:21 2|2013-05-22 07:50:22 1|2013-05-22 07:50:24 3|2013-05-22 07:50:34 1|2013-05-22 07:50:36 3|2013-05-22 07:50:37 3|2013-05-22 07:50:39 1|2013-05-22 07:50:41 6|2013-05-22 07:58:24 Now I would like to delete the oldest rows if a group of id has more than three, but I would like to keep the youngest ones in each id group. I can delete with offset for the overall table. Is this possible for a group? The lastactivity column is unique. Cheers, Patrik -- ASCII ribbon campaign ( ) against HTML e-mail X www.asciiribbon.org / \ _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users