Received: from web6305.mail.yahoo.com (web6305.mail.yahoo.com [128.11.22.142]) by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f2EMTIx92615 for ; Wed, 14 Mar 2001 17:29:19 -0500 (EST) (envelope-from srirao_us@yahoo.com) Message-ID: <20010314222916.11494.qmail@web6305.mail.yahoo.com> Received: from [143.209.7.248] by web6305.mail.yahoo.com; Wed, 14 Mar 2001 14:29:16 PST Date: Wed, 14 Mar 2001 14:29:16 -0800 (PST) From: Srikanth Rao Subject: PIVOT of data To: pgsql-sql@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Archive-Number: 200103/295 X-Sequence-Number: 1959 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/