agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Gerardo Herzig <gherzig@fmed.uba.ar>
To: Olivier Leprêtre <o.lepretre@gmail.com>
Cc: pgsql-sql@lists.postgresql.org
Subject: Re: Window ?
Date: Wed, 13 Jun 2018 14:51:11 +0000 (UTC)
Message-ID: <1734068522.267007.1528901471548.JavaMail.zimbra@fmed.uba.ar> (raw)
In-Reply-To: <1665819120.267000.1528901466329.JavaMail.zimbra@fmed.uba.ar>
References: <5b212b57.1c69fb81.2e3b4.1d26@mx.google.com>



----- 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




view thread (5+ messages)  latest in thread

Message-ID: <1734068522.267007.1528901471548.JavaMail.zimbra@fmed.uba.ar>
Permalink:  ../1734068522.267007.1528901471548.JavaMail.zimbra@fmed.uba.ar/
Also on:    postgresql.org/message-id/1734068522.267007.1528901471548.JavaMail.zimbra@fmed.uba.ar

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: gherzig@fmed.uba.ar, o.lepretre@gmail.com, pgsql-sql@lists.postgresql.org
  Subject: Re: Window ?
  In-Reply-To: <1734068522.267007.1528901471548.JavaMail.zimbra@fmed.uba.ar>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox