Re: Looking for correct SQL - Mailing list pgsql-novice

From Michael Fuhr
Subject Re: Looking for correct SQL
Date
Msg-id 20041014200221.GA96446@winnie.fuhr.org
Whole thread Raw
In response to Looking for correct SQL  (Alexander Pucher <pucher@atlas.gis.univie.ac.at>)
List pgsql-novice
On Thu, Oct 14, 2004 at 09:46:33PM +0200, Alexander Pucher wrote:
>
> I have a table like this:
>
> name    key            value
> -------------------------
> andi    age                23
> andi    hometown    boston
> tom    age                45
> greg    hometown    miami
>
>
> I would like to get the following through a SQL Select Statement:
>
>
> name    age    hometown
> -------------------------
> andy    23        boston
> tom      45         NULL
> greg      NULL   miami

Take a look at the crosstab functions in contrib/tablefunc.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

pgsql-novice by date:

Previous
From: Michael Fuhr
Date:
Subject: Re: copy error
Next
From: "Adam I. Harris, M.D."
Date:
Subject: Getting Started