Re: How to enumerate partitions from a window function?

Поиск
Список
Период
Сортировка
От Michael Lewis
Тема Re: How to enumerate partitions from a window function?
Дата
Msg-id CAHOFxGqXc0f6SDQczmMdMRX6mtup0YHE2SwFbenmii28DX8zDw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: How to enumerate partitions from a window function?  (Alban Hertroys <haramrae@gmail.com>)
Ответы Re: How to enumerate partitions from a window function?  (Alban Hertroys <haramrae@gmail.com>)
Список pgsql-general
It seems like you are maybe wanting this- If the previous row is the same, then get the previous row's run_nr. If it is different, then increment.

case when lag( property_A ) over() = property_A and lag( property_B ) over() = property_B then coalesce( lag( run_nr ) over(), 1 ) else lag( run_nr ) over() + 1 end

Perhaps there is a much simpler implementation though.

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

Предыдущее
От: Lawrence Layhee
Дата:
Сообщение: Dependency problem using community repo on Redhat 7
Следующее
От: "Yang, Rong"
Дата:
Сообщение: how to get top plan of GatherMerge in OSS10