Re: help with generation_series in pg10

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: help with generation_series in pg10
Дата
Msg-id CAKFQuwaHkjU47EHin7_7JRjvC1SL-pL=HvUyNVHepuLqRaLpwA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: help with generation_series in pg10  (Adrian Klaver <adrian.klaver@aklaver.com>)
Список pgsql-general
On Monday, January 8, 2018, Adrian Klaver <adrian.klaver@aklaver.com> wrote:

I am not seeing a solution, but you might see something that would help you.

There is no general solution.  For the problem at hand I would union two generate_series(1,5) queries with a query_id column.  Then I'd use row_number() over (order by query_id, series_num) to compute the column containing the values 1-10.

Alternatively, use the modulus operator (% 5) on 1-10 to generate the second column.

David J.

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

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: help with generation_series in pg10
Следующее
От: Agnar Renolen
Дата:
Сообщение: Getting started with first user.