pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: Josh Berkus <josh@agliodbs.com>
To: Kurt Overberg <kurt@hotdogrecords.com>
To: pgsql-sql@postgresql.org
Subject: Re: Selecting rows as if they were columns?
Date: Thu, 9 Oct 2003 18:57:37 +0100
Message-ID: <200310091857.37460.dev@archonet.com> (raw)
In-Reply-To: <200310091014.09695.josh@agliodbs.com>
References: <3F855F38.9070803@hotdogrecords.com>
	<200310091014.09695.josh@agliodbs.com>

On Thursday 09 October 2003 18:14, Josh Berkus wrote:
> 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.

Or see the contrib/tablefunc functions which can do this sort of thing for 
you.

-- 
  Richard Huxton
  Archonet Ltd



view thread (4+ messages)

Message-ID: <200310091857.37460.dev@archonet.com>
Permalink:  ../200310091857.37460.dev@archonet.com/
Also on:    postgresql.org/message-id/200310091857.37460.dev@archonet.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: dev@archonet.com, josh@agliodbs.com, kurt@hotdogrecords.com
  Subject: Re: Selecting rows as if they were columns?
  In-Reply-To: <200310091857.37460.dev@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