Re: How to transform table rows into Colum?

From: Richard Albright <ralbright(at)insiderscore(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: How to transform table rows into Colum?
Date: 2011-03-17 17:12:07
Message-ID: 4D8240E7.1030008@insiderscore.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)insiderscore(dot)com <mailto:ralbright(at)insiderscore(dot)com>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Good, Thomas 2011-03-17 17:27:22 Re: Bizarreness at A2 Hosting
Previous Message John DeSoi 2011-03-17 17:05:03 Re: Bizarreness at A2 Hosting