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)
More Related Contents:
- INNER JOIN ON vs WHERE clause
- MySQL: Alternatives to ORDER BY RAND()
- MySQL LIKE IN()?
- Auto Increment after delete in MySQL
- In MySQL queries, why use join instead of where?
- MySQL function to find the number of working days between two dates
- MySQL Trigger to prevent INSERT under certain conditions
- MySQL “NOT IN” query
- Emulate MySQL LIMIT clause in Microsoft SQL Server 2000
- What’s the difference between VARCHAR and CHAR?
- Alter a MySQL column to be AUTO_INCREMENT
- Importance of varchar length in MySQL table
- mySQL :: insert into table, data from another table?
- Return 0 if field is null in MySQL
- MySQL “between” clause not inclusive?
- MySQL syntax for Join Update
- SQL – How to transpose?
- MySQL remove duplicates from big database quick
- How to delete from select in MySQL?
- How to delete Duplicates in MySQL table
- SQL SELECT to get the first N positive integers
- Sorting string column containing numbers in SQL?
- Multiple Ranks in one table
- The difference between ‘AND’ and ‘&&’ in SQL
- How can I make an average of dates in MySQL?
- How to combine aggregate functions in MySQL?
- What is the best way to generate ranks in MYSQL?
- How to find all IDs of children recursively?
- In SQL how do I get the maximum value for an integer?
- Get the first and last date of next month in MySQL