crosstab function - pivot - use column value as column description

From: Daniel Schuchardt <d(dot)schuchardt(at)prodat-sql(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: crosstab function - pivot - use column value as column description
Date: 2010-01-12 20:27:06
Message-ID: hiiluf$sv0$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hy,

i'm looking for a solution to get this table dynamicaly in that resultset:

SELECT r_dbrid, r_kategorie AS column_name, r_descr AS value FROM
recnokeyword WHERE r_dbrid=X
r_dbrid | r_kategorie | r_descr
----------+-------------+------------
14725737 |material | Alu Sorte1
14725737 |farbe | Blau
14725737 |gewicht | 100 kg

---->

material | farbe | gewicht
----------+-------------+------------
alu sorte 1|blau | 100kg

----> the number of columns depends on data.

is there is a simple solution for that?
--

Daniel Schuchardt
/Softwareentwicklung/

/http://www.prodat-sql.de/

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2010-01-12 21:00:28 Re: crosstab function - pivot - use column value as column description
Previous Message Omar Mehmood 2010-01-12 19:50:47 Re: replication from multiple "master" servers to a single read-only slave