Cory Nelson <[email protected]> wrote:
> On Tue, Sep 28, 2010 at 3:32 AM, Ian Hardingham <[email protected]> wrote:
>> If I have a table with a PRIMARY KEY AUTOINCREMENT id column, and I have
>> an id for a row, is there an Order(1) method of selecting the next row?
>> 
>> I can't necessarilly guarantee that id + 1 exists, as it may be deleted.
> 
> Try WHERE id>previousid ORDER BY id LIMIT 1.

Note that this is O(log N), not O(1). There is no O(1) method to do this (or 
pretty much anything else in SQLite), to my knowledge.
-- 
Igor Tandetnik

_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to