Multiple Results with crosstab function

From: "Sven Haag" <sven-haag(at)gmx(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: Multiple Results with crosstab function
Date: 2011-04-12 07:53:24
Message-ID: 20110412075324.137120@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi postgres fans,

i'm already using the crosstab function but it shows up an issue with multiple results in the same category. example table:

row_name cat value
----------+-------+-------
row1 cat1 val1
row1 cat1 val2
row1 cat3 val3
row1 cat4 val4
row2 cat1 val5
row2 cat2 val6
row2 cat2 val7
row2 cat4 val8

the crosstab function (as far as i know) usually assumes that only 1 value belongs to 1 category. but unfortunatelly in our database it is possible that 1 category has 2 or more values.

is there a way to tell the crosstab function that it should show 2 rows when there is more then 1 value per category? by now only the first value of the selection criteria is shown.

thanks in advance for every hint.
sven

ps: http://stackoverflow.com/questions/5622981/multiple-results-with-postgresql-crosstab-function

--
Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de

Browse pgsql-general by date

  From Date Subject
Next Message salah jubeh 2011-04-12 09:47:12 What is the difference between these queries
Previous Message David Johnston 2011-04-12 06:59:25 Re: what data type to store fixed size integer?