I have a postgres table A where I am looking to query n rows above and below a certain chosen value in a column. I have already implemented two basic queries as shown below
SELECT * FROM A
WHERE a >= 100
AND a <= 100+n
and
SELECT * FROM A
WHERE a <= 100
AND a >= 100-n
Is there a way to merge these two queries into 1 instead of having to define two separate queries?