| From: | "Leif B(dot) Kristensen" <leif(at)solumslekt(dot)org> |
|---|---|
| To: | pgsql-sql(at)postgresql(dot)org |
| Subject: | Re: "Flattening" query result into columns |
| Date: | 2005-03-21 22:37:08 |
| Message-ID: | 200503212337.08682.leif@solumslekt.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
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/
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Theo Galanakis | 2005-03-21 22:46:39 | C function extending postgres |
| Previous Message | Thomas Borg Salling | 2005-03-21 21:57:13 | "Flattening" query result into columns |