Great, thanks Igor. On 31/01/2011 14:45, Igor Tandetnik wrote: > Ian Hardingham<[email protected]> wrote: >> I wish to get the "next" record of a certain type, such that if we have >> row Id x, then: >> >> Select the minimum id such that id> x (with some WHERE conditions) >> If there is no such id (ie x is the largest with the conditions) then >> the first id with those conditions is returned. > select coalesce ( > (select id from mytable where id> :x and conditions order by id limit > 1), > (select id from mytable where conditions order by id limit 1) > ); >
_______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

