Re: Window function?

Поиск
Список
Период
Сортировка
От Robert Stanford
Тема Re: Window function?
Дата
Msg-id CAC1FqCEkcwPz4_hqZ3_0Yav010veB+VtGNjJDBnEUTXwx7j6xw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Window function?  (Thiemo Kellner <thiemo@gelassene-pferde.biz>)
Список pgsql-general

On Sat, 4 Jun 2022 at 22:56, Thiemo Kellner <thiemo@gelassene-pferde.biz> wrote:

Hi Robert

Interesting problem. I need to think about it.

You need to figure out when Input changes. You can achieve this by using lead or lag (depending of the sort direction over start) https://www.postgresql.org/docs/current/functions-window.html .

After a bit of poking around this seems to get things going in the right direction.

select row_number() over (order by start)  - row_number() over (partition by input order by start) 

  

В списке pgsql-general по дате отправления:

Предыдущее
От: Thiemo Kellner
Дата:
Сообщение: Re: Window function?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Window function?