pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Leif B. Kristensen <leif@solumslekt.org>
To: pgsql-sql@postgresql.org
Subject: Re: "Flattening" query result into columns
Date: Mon, 21 Mar 2005 23:37:08 +0100
Message-ID: <200503212337.08682.leif@solumslekt.org> (raw)
In-Reply-To: <20050321215723.E79E356388@svr1.postgresql.org>
References: <20050321215723.E79E356388@svr1.postgresql.org>

On Monday 21 March 2005 22:57, Thomas Borg Salling wrote:
> I am looking for a way to "flatten" a query result, so that rows are
> "transposed" into columns, just as asked here for oracle:
>
> Is there any way to do this with pgsql  ?

Just to help out the guys, here's a working link:

<http://groups.google.dk/groups?hl=da&selm=aad10be0.0401292322.7b6c320b%40posting.google.com;

What you're asking for is called a pivot table, and at least in Oracle 
they use a function called decode(). I need exactly the same thing, but 
I too am unable to find the optimal way to do it in PostgreSQL.
-- 
Leif Biberg Kristensen
http://solumslekt.org/



view thread (7+ messages)  latest in thread

Message-ID: <200503212337.08682.leif@solumslekt.org>
Permalink:  ../200503212337.08682.leif@solumslekt.org/
Also on:    postgresql.org/message-id/200503212337.08682.leif@solumslekt.org

 · 

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: leif@solumslekt.org
  Subject: Re: "Flattening" query result into columns
  In-Reply-To: <200503212337.08682.leif@solumslekt.org>

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

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