Re: Looking for correct SQL

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Alexander Pucher <pucher(at)atlas(dot)gis(dot)univie(dot)ac(dot)at>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Looking for correct SQL
Date: 2004-10-14 20:02:22
Message-ID: 20041014200221.GA96446@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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/

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Adam I. Harris, M.D. 2004-10-15 11:06:31 Getting Started
Previous Message Michael Fuhr 2004-10-14 19:46:47 Re: copy error