Bart Smissaert <bart.smissa...@gmail.com> wrote: > If we have the 14 (we know to start at 14) can we select the records > 14, 13, 12 and 11, > so the consecutive numbers, going down from 14?
select * from MyTable t1 where (select count(*) from MyTable t2 where t2.ID between t1.ID and 14) == 14 - t1.ID + 1; Personally, I'd just run a query like select * from MyTable where ID <= 14 order by ID desc; and step through it until the next ID is non-consecutive. -- Igor Tandetnik _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users