Похожие чаты

Hi guys in postgres im trying to implement a pagination I need

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?

3 ответов

14 просмотров

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

QWxp- Автор вопроса

Похожие вопросы

Обсуждают сегодня

А еще в перле можно уже @arr1 + @arr2?
Sergei Zhmylove
53
I arrived here after a Chico Crypto show highlighted the project & the Team - the fact that the Team had a long history of successfully working with household names gave me e...
Banter is Bullish
1
Привет всем. появился вопрос. Разрабатываю сайт, в данный момент он запущен. Хостинг beget. Добавляю на сайт яндекс метрику с помощью полей client-settings (взято отсюда http...
Andrew
2
я не магистр хаскеля, но разве не может лейзи тип конвертнуться в не-лейзи запросив вычисление содержимого прям при инициализации?
deadgnom32 λ madao
100
;.686 ;Система команд процессора 686 ;.MODEL FLAT,stdcall ;Модель памяти плоская, стандартный ;вызов процедуры ;option casemap:no...
Егор Анелькин
1
Почему у макбука экран не сенсорный?
✨ Anatolii Cherednichenko
28
It's unfortunate that the "Then why are you here" or "lol you must've bought high" mantras always come up. I already tried bringing up this subject in the price channel but si...
Leroy Gerrits
4
Есть вопрос: допустим есть железка с каким-то интерфейсом(допустим usb), но как по этому интерфейсу железкой управлять неизвестно, прог нету, а управлять очень хочется надо. К...
Mixail Frolov
15
Is it a good price to buy hex now on 0,0019?
Patrick
29
Всем привет! подскажите пожалуйста как можно увеличить качество фото?
Evgeniy
19
Карта сайта