to query N rows before and after a specific ID
my problem is implementing the "before" part
I do "where id < X limit 10" psql gives me the first 10 rows in the table
how can I tell it to start from X and get the 10 previous rows?
i tried to use the cursor but cant make it work
any suggestions?
Sort it in descending order of id and you'll get ones closest to X then.
https://dba.stackexchange.com/questions/252256/select-n-rows-before-after-specified-row
already saw this didn't help
Обсуждают сегодня