I have following ids in my table.
[25,26,36]
I am able to fetch next and prev id easily if current id is 26 but I am not able to get next and prev id if current id 36. It is giving me a null record of next. Is there any possibility to give me id circularly. Here is my code which I use for next and prev id getting.
next record:
SELECT * FROM foo WHERE id > 26 ORDER BY id LIMIT 1;
previous record:
SELECT * FROM foo WHERE id < 26 ORDER BY id DESC LIMIT 1;