turning a table by 90 degrees

Поиск
Список
Период
Сортировка
От news-list.pgsql.sql@innominate.de (Thilo Mezger)
Тема turning a table by 90 degrees
Дата
Msg-id news2mail-82l4el$9g9$2@mate.bln.innominate.de
обсуждение исходный текст
Ответы Re: [SQL] turning a table by 90 degrees  (Peter Eisentraut <peter_e@gmx.net>)
Список 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@innominate.de                                                       innominate AG
                  networking people
 
fon: +49.30.308806-11 fax: -77 web: http://innominate.de pgp: /pgp/tm


В списке pgsql-sql по дате отправления:

Предыдущее
От: Fred Schoonewille
Дата:
Сообщение: select a part of a name
Следующее
От: Vladimir Terziev
Дата:
Сообщение: Re: [SQL] Getting last used oid