Re: How to transform table rows into Colum?

From: Dmitriy Igrishin <dmitigr(at)gmail(dot)com>
To: Eric Ndengang <eric(dot)ndengang_foyet(at)affinitas(dot)de>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: How to transform table rows into Colum?
Date: 2011-03-09 18:07:53
Message-ID: AANLkTimRXw398CXQOXHXqrYR7skqDwk9hFRzmfH7vpNZ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hey Eric,

2011/3/9 Eric Ndengang <eric(dot)ndengang_foyet(at)affinitas(dot)de>

> Hi Guys,
> I have the following table:
>
> Name Value rang salary
> ------------------------------------
> name1 value1 1 2500
> name2 value2 2 2600
> name3 value 3 3 300
>
> and want to obtain the following result:
>
> name1 name2 name3
> ------------------------------------
> value1 value2 value3
> 1 2 3
> 2500 2600 300
>
> what should i do ? I read about the crosstab function in postgresql but
> still have no idea on how to use it to solve this problem.
> Any help would be appreciated
>
Please, see the complete example here:
http://www.postgresql.org/docs/9.0/static/tablefunc.html

> Regards
>
> --
> Eric Ndengang
> Datenbankadministrator
>
> Affinitas GmbH | Kohlfurter Straße 41/43 | 10999 Berlin | Germany
> email: eric(dot)ndengang_foyet(at)affinitas(dot)de | tel: +49.(0)30. 991 949 5 0 |
> www.edarling.de
>
> Geschäftsführer: Lukas Brosseder, David Khalil, Kai Rieke, Christian
> Vollmann
> Eingetragen beim Amtsgericht Berlin, HRB 115958
>
>
> --
> Sent via pgsql-sql mailing list (pgsql-sql(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
>

--
// Dmitriy.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Uwe Bartels 2011-03-09 21:55:18 plpgsql exception handling
Previous Message Eric Ndengang 2011-03-09 17:16:44 How to transform table rows into Colum?