I am a Developer, Blogger and Coffee addict. Java developer by profession, Q2A developer by addiction. This is my personal website where I write few stuff which could be useful for other developers.
© 2020. All rights reserved.
Query to get Next record in MySQL
SELECT * FROM foo WHERE id = (SELECT MIN(id) FROM foo WHERE id > 4)
Query to get Previous record in MySQL
SELECT * FROM foo WHERE id = (SELECT MAX(id) FROM foo WHERE id < 4)