Mysql
 sql >> Base de Dados >  >> RDS >> Mysql

Como obter o registro seguinte/anterior no MySQL?


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

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