Re: Selecting rows as if they were columns?

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: Kurt Overberg <kurt(at)hotdogrecords(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Selecting rows as if they were columns?
Date: 2003-10-09 17:14:09
Message-ID: 200310091014.09695.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Kurt,

> I've got what I think should be a pretty simple problem- I just can't
> figure out how I'd do it. Heck, I can't even figure out how I'd search
> for an answer to this problem.

This is an old common SQL problem ... the "crosstab" table. There are 3
standard ways to solve it, depending on the exact circumstances of your case.
It's probably best if you buy Joe Celko's "SQL for Smarties, 2nd Ed.", which
has a 50-page chapter on the topic and explores the methods in detail.

--
Josh Berkus
Aglio Database Solutions
San Francisco

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Slava Gorski 2003-10-09 17:29:03 get diagnostics not supported by ecpg?
Previous Message Janko Richter 2003-10-09 16:58:42 Re: select