[postgis-users] Create mutliple rows from a field

Mickael Borne Mickael.Borne at ign.fr
Thu May 18 10:27:54 PDT 2017


You should have a look to generate_series :


De : postgis-users [postgis-users-bounces at lists.osgeo.org] de la part de Olivier Leprêtre [o.lepretre at gmail.com]
Date d'envoi : jeudi 18 mai 2017 19:05
À : 'PostGIS Users Discussion'
Objet : [postgis-users] Create mutliple rows from a field


I have a table with 2 columns : id, x (x is an int from 0 to n)

Is it possible to create a query that will return x ranked rows for each id ?


id       x
A        2
B        3
C        1
D       4

will return

A        1
A        2
B        1
B        2
B        3
C        1
D       1
D       2
D       3
D       4

I searched with OVER, PARTITION, RANK... without success



[https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif]<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>      Garanti sans virus. www.avast.com<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20170518/6e9c8906/attachment.html>

More information about the postgis-users mailing list