Hey guys:

I'm trying to retrieve records (matching some conditional) relative to a certain column (ID).

For example: if these are the IDs that match the conditional


I'd like to start from say 8, and retrieve the two closest matches on either side, 5,6 and 10,12.

Is there any way to do this with one query? or would I have to have 3 separate queries--one to retrieve the relative record, one to retrieve the records before this relative record, and one to retrieve the records after this relative record?