Skip to content
Advertisement

How to get current and previous ids of current id in one query(mysql)

My table is like this:

The current empid is for example 10, I want the previous and next empids from the database.

The next and previous values may not be 11 and 9 respectively, I need to get it from the database only in a single query. Could any body please help me with this?

Advertisement

Answer

ex. empid = 4

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement