I need a query that will fetch a single item before a certain Id and an item after that same Id.
For example I have five rows, id's 1 to 5 and i need to select id before and after id 3, so that I get 2 and 4 as a results.
Is there a way to do it with a single query?
Edit:
I forgot to tell that maybe results would not be siblings but next sibling that matches criteria:
SELECT routeId FROM routes WHERE routeId>::p0:: AND assetKmId<>'0'
so next or previous sibling should match assetKmId<>'0' (this routeId>::p0:: is ofcourse not valid in this scenario)