From: dev@archonet.com
To: pgsql-sql@postgresql.org
Subject: Crosstab-style query in pure SQL
Date: Mon, 13 Jan 2003 12:47:01 -0000 (GMT)
Message-ID: <1493.192.168.1.16.1042462021.squirrel@mainbox.archonet.com> (raw)
TIA all
I have a table containing milestones achieved for projects, marked as
being in particular quarters.
CREATE TABLE milestones (
proj_id int4,
sortorder SERIAL,
qtr int4,
description varchar(200)
);
Now I need the milestone descriptions output across the page like:
proj_id | q1 | q2 | q3 | q4
and sorted according to "sortorder".
Judicious use of CASE can get me the quarterly columns but I need to
eliminate holes. Any clever ideas without resorting to procedural
solutions (either table function or application code)?
TIA
- Richard Huxton
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: dev@archonet.com
Subject: Re: Crosstab-style query in pure SQL
In-Reply-To: <1493.192.168.1.16.1042462021.squirrel@mainbox.archonet.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