From: | Gerardo Herzig <gherzig(at)fmed(dot)uba(dot)ar> |
---|---|
To: | Olivier Leprêtre <o(dot)lepretre(at)gmail(dot)com> |
Cc: | pgsql-sql(at)lists(dot)postgresql(dot)org |
Subject: | Re: Window ? |
Date: | 2018-06-13 14:51:11 |
Message-ID: | 1734068522.267007.1528901471548.JavaMail.zimbra@fmed.uba.ar |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
----- Mensaje original -----
> De: "Olivier Leprêtre" <o(dot)lepretre(at)gmail(dot)com>
> Para: pgsql-sql(at)lists(dot)postgresql(dot)org
> Enviados: Miércoles, 13 de Junio 2018 11:33:50
> Asunto: Window ?
> Hi,
>
>
>
> I have a road segment table with a few attributes for each. For each
> segment, I have a road index and a segment index something like :
>
>
>
> road seg colA
>
> 1 1 att1
>
> 1 2 att2
>
> 1 3 att3
>
> 1 4 att4
>
> 2 1 att5
>
> 2 2 att6
>
>
>
> I want to convert records into lines,
>
>
>
> 1 att1 att2 att3 att4
>
> 2 att5 att6 ...
>
>
Looks like a solution with "pivot":
https://www.postgresql.org/docs/current/static/tablefunc.html
Look for "crosstab" functions.
HTH
Gerardo
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2018-06-13 14:54:45 | Re: Window ? |
Previous Message | Olivier Leprêtre | 2018-06-13 14:33:50 | Window ? |