Search Postgresql Archives

Re: help with generation_series in pg10

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Monday, January 8, 2018, Adrian Klaver <adrian.klaver@xxxxxxxxxxx> 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.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux