Received: from hermes.mixx.net (root@hermes.mixx.net [212.84.196.35]) by hub.org (8.9.3/8.9.3) with ESMTP id DAA27128 for ; Wed, 8 Dec 1999 03:21:45 -0500 (EST) (envelope-from news-list.pgsql.sql@innominate.de) Received: from mate.bln.innominate.de (gatekeeper.innominate.de [212.5.16.129]) by hermes.mixx.net (8.9.3/8.9.3) with ESMTP id JAA28275 for ; Wed, 8 Dec 1999 09:21:42 +0100 Received: by mate.bln.innominate.de (Postfix, from userid 9) id B30222CA73; Wed, 8 Dec 1999 09:21:42 +0100 (CET) From: news-list.pgsql.sql@innominate.de (Thilo Mezger) Reply-To: Thilo Mezger X-Newsgroups: innominate.bln.list.pgsql.sql Subject: turning a table by 90 degrees Date: 8 Dec 1999 08:21:41 GMT Organization: innominate AG, Berlin, Germany Lines: 35 Message-ID: X-Trace: mate.bln.innominate.de 944641301 9737 192.168.0.25 (8 Dec 1999 08:21:41 GMT) X-Complaints-To: news@innominate.de User-Agent: tin/pre-1.4-19990517 ("Psychonaut") (UNIX) (Linux/2.2.12-20 (i586)) To: pgsql-sql@postgresql.org 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@innominate.de innominate AG networking people fon: +49.30.308806-11 fax: -77 web: http://innominate.de pgp: /pgp/tm