pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Srikanth Rao <srirao_us@yahoo.com>
To: pgsql-sql@postgresql.org
Subject: PIVOT of data
Date: Wed, 14 Mar 2001 14:29:16 -0800 (PST)
Message-ID: <20010314222916.11494.qmail@web6305.mail.yahoo.com> (raw)

Hi, 
I have a table like this:
       location        | numbrochures | marketing 
-----------------------+--------------+-----------
 101 Asheville, NC     |            4 | NEWS
 101 Asheville, NC     |            1 | TV
 101 Asheville, NC     |            3 | RADIO
 101 Asheville, NC     |            2 | OTHER
 101 Asheville, NC     |            3 | null
 101 Asheville, NC     |            1 | TV
 102 'Charlotte', 'NC' |            1 | SIGN
 104 'Colfax', 'NC'    |            5 | SIGN
 109 'Moyock', 'NC'    |            1 | BROCHURE
(9 rows)


I want the headings to be  like:

location | NEWS | TV | RADIO | OTHER | ........

How to get this done using sql for postgresql backend?

TIA,
Sri.

__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - Buy the things you want at great prices.
http://auctions.yahoo.com/



view thread (4+ messages)  latest in thread

Message-ID: <20010314222916.11494.qmail@web6305.mail.yahoo.com>
Permalink:  ../20010314222916.11494.qmail@web6305.mail.yahoo.com/
Also on:    postgresql.org/message-id/20010314222916.11494.qmail@web6305.mail.yahoo.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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: srirao_us@yahoo.com
  Subject: Re: PIVOT of data
  In-Reply-To: <20010314222916.11494.qmail@web6305.mail.yahoo.com>
  References: <20010314222916.11494.qmail@web6305.mail.yahoo.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