pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Albright <ralbright@insiderscore.com>
To: pgsql-sql@postgresql.org
Subject: Re: How to transform table rows into Colum?
Date: Thu, 17 Mar 2011 13:12:07 -0400
Message-ID: <4D8240E7.1030008@insiderscore.com> (raw)
In-Reply-To: <4D77B5FC.6010502@affinitas.de>
References: <4D77B5FC.6010502@affinitas.de>

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>

view thread (3+ messages)

Message-ID: <4D8240E7.1030008@insiderscore.com>
Permalink:  ../4D8240E7.1030008@insiderscore.com/
Also on:    postgresql.org/message-id/4D8240E7.1030008@insiderscore.com

 · 

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: ralbright@insiderscore.com
  Subject: Re: How to transform table rows into Colum?
  In-Reply-To: <4D8240E7.1030008@insiderscore.com>

* 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