SQL: how to select next id given an id

Posted by Marcin K on Stack Overflow See other posts from Stack Overflow or by Marcin K
Published on 2010-04-21T19:54:39Z Indexed on 2010/04/21 20:03 UTC
Read the original article Hit count: 317

Filed under:

There is one table T ( id integer, primary key ( id).
I want a parameterized query that, given id i:
will return next consecutive id,
if i = biggest id in T, query should return the smallest id in T (cyclical)

© Stack Overflow or respective owner

Related posts about sql