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)
Список
Дерево обсуждения
help with generation_series in pg10 Márcio A. Sepp <marcio@zyontecnologia.com.br>
Re: help with generation_series in pg10 Alvaro Herrera <alvherre@alvh.no-ip.org>
RES: help with generation_series in pg10 Márcio A. Sepp <marcio@zyontecnologia.com.br>
Re: RES: help with generation_series in pg10 Alvaro Herrera <alvherre@alvh.no-ip.org>
Re: help with generation_series in pg10 Merlin Moncure <mmoncure@gmail.com>
RES: help with generation_series in pg10 Márcio A. Sepp <marcio@zyontecnologia.com.br>
Re: help with generation_series in pg10 Vincenzo Romano <vincenzo.romano@notorand.it>
Re: help with generation_series in pg10 Adrian Klaver <adrian.klaver@aklaver.com>
Re: help with generation_series in pg10 Merlin Moncure <mmoncure@gmail.com>
Re: help with generation_series in pg10 "David G. Johnston" <david.g.johnston@gmail.com>
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 по дате отправления