turning a table by 90 degrees

From: news-list(dot)pgsql(dot)sql(at)innominate(dot)de (Thilo Mezger)
To: pgsql-sql(at)postgresql(dot)org
Subject: turning a table by 90 degrees
Date: 1999-12-08 08:21:41
Message-ID: news2mail-82l4el$9g9$2@mate.bln.innominate.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

hi,

i've got a table like this (plus a primary key and some other fields):

key | value | custid
---------+---------+---------
name | peter | 2
age | 123 | 2
foo | bar | 2
[...] | |
name | john | 3
[...]

you can think of a table which is turned by 90 degrees. this can be
quite useful when you don't know in advance what key/values pairs you
have to store.

now it would be nice to find a query which returns this result for
custid=2:

name | age | foo
------+-----+------
peter | 123 | bar

any ideas?!

thilo

--
mezger(at)innominate(dot)de
innominate AG
networking people
fon: +49.30.308806-11 fax: -77 web: http://innominate.de pgp: /pgp/tm

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Vladimir Terziev 1999-12-08 08:36:51 Re: [SQL] Getting last used oid
Previous Message Fred Schoonewille 1999-12-08 08:12:32 select a part of a name