Get the ID of a next greater/less Value
You can just join the table to itself on the id field = the value + 1 and again on value - 1. My example uses an INNER JOIN which will only return the cases where both match, otherwise you'll want to use the appropriate OUTER JOINS or two separate queries, to not filter out.
SELECT * -- Replace with only the columns you need as SELECT * is bad practice
FROM SomeTable ST1
INNER JOIN SomeTable ST2
    ON ST2.id = ST1.value + 1
INNER JOIN SomeTable ST3
    ON ST2.id = ST1.value - 1