pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedHow to transform table rows into Colum?
3+ messages / 3 participants
[nested] [flat]
* How to transform table rows into Colum?
@ 2011-03-09 17:16 Eric Ndengang <eric.ndengang_foyet@affinitas.de>
2011-03-09 18:07 ` Re: How to transform table rows into Colum? Dmitriy Igrishin <dmitigr@gmail.com>
2011-03-17 17:12 ` Re: How to transform table rows into Colum? Richard Albright <ralbright@insiderscore.com>
0 siblings, 2 replies; 3+ messages in thread
From: Eric Ndengang @ 2011-03-09 17:16 UTC (permalink / raw)
To: pgsql-sql
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
Regards
--
Eric Ndengang
Datenbankadministrator
Affinitas GmbH | Kohlfurter Straße 41/43 | 10999 Berlin | Germany
email: eric.ndengang_foyet@affinitas.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
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: How to transform table rows into Colum?
2011-03-09 17:16 How to transform table rows into Colum? Eric Ndengang <eric.ndengang_foyet@affinitas.de>
@ 2011-03-09 18:07 ` Dmitriy Igrishin <dmitigr@gmail.com>
1 sibling, 0 replies; 3+ messages in thread
From: Dmitriy Igrishin @ 2011-03-09 18:07 UTC (permalink / raw)
To: Eric Ndengang <eric.ndengang_foyet@affinitas.de>; +Cc: pgsql-sql
Hey Eric,
2011/3/9 Eric Ndengang <eric.ndengang_foyet@affinitas.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.ndengang_foyet@affinitas.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@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
>
--
// Dmitriy.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: How to transform table rows into Colum?
2011-03-09 17:16 How to transform table rows into Colum? Eric Ndengang <eric.ndengang_foyet@affinitas.de>
@ 2011-03-17 17:12 ` Richard Albright <ralbright@insiderscore.com>
1 sibling, 0 replies; 3+ messages in thread
From: Richard Albright @ 2011-03-17 17:12 UTC (permalink / raw)
To: pgsql-sql
you can also generate a crosstab table using the sign function
you can check out the link below ( its a sqlite tutorial, but the same
idea will work for pg too )
http://souptonuts.sourceforge.net/readme_sqlite_tutorial.html
On 03/09/2011 12:16 PM, Eric Ndengang wrote:
> 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
> Regards
>
--
*Rick Albright*
Senior Quantitative Analyst
Web: www.insiderscore.com <https://www.insiderscore.com/;
Email: ralbright@insiderscore.com <mailto:ralbright@insiderscore.com>
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2011-03-17 17:12 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-03-09 17:16 How to transform table rows into Colum? Eric Ndengang <eric.ndengang_foyet@affinitas.de>
2011-03-09 18:07 ` Dmitriy Igrishin <dmitigr@gmail.com>
2011-03-17 17:12 ` Richard Albright <ralbright@insiderscore.com>
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