Re: Window ? - Mailing list pgsql-sql

From Gerardo Herzig
Subject Re: Window ?
Date
Msg-id 1734068522.267007.1528901471548.JavaMail.zimbra@fmed.uba.ar
Whole thread Raw
In response to Window ?  (Olivier Leprêtre <o.lepretre@gmail.com>)
List pgsql-sql

----- Mensaje original -----
> De: "Olivier Leprêtre" <o.lepretre@gmail.com>
> Para: pgsql-sql@lists.postgresql.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


pgsql-sql by date:

Previous
From: Olivier Leprêtre
Date:
Subject: Window ?
Next
From: "David G. Johnston"
Date:
Subject: Re: Window ?