Say your query is something like:
select ID
from stuff
where ID > $id
order by ID
limit 5
Now say you set $id = 10 and the max ID is 12, is there any way to "wrap" the results so you get:
ID= 11, 12, 1, 2, 3
Right now I get the max id, do multiple queries, etc.