My SQL

MySQL : Get Next or Previous record


Next Previous Query on the Basis of Current Record (i.e. 4) -

next:
 select * from foo where id = (select min(id) from foo where id > 4)

previous:
 select * from foo where id = (select max(id) from foo where id < 4)


No comments:

Post a Comment