Looking for correct SQL - Mailing list pgsql-novice

From Alexander Pucher
Subject Looking for correct SQL
Date
Msg-id 416ED799.4020809@atlas.gis.univie.ac.at
Whole thread Raw
Responses Re: Looking for correct SQL
List pgsql-novice
Hi,

I'm struggling for some time with the following problem:

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

I thought about a subselect, but could'nt find the clue.

Thanks for any input,
best regards,
alex.

pgsql-novice by date:

Previous
From: "Keith Worthington"
Date:
Subject: copy error
Next
From: Michael Fuhr
Date:
Subject: Re: copy error