Re: Window ?
Gerardo Herzig <[email protected]>
| Newsgroups | gmane.comp.db.postgresql.sql |
|---|---|
| Message-ID | <[email protected]> |
----- Mensaje original ----- > De: "Olivier Leprêtre" <[email protected]> > Para: [email protected] > 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