Re: dynamic crosstab - Mailing list pgsql-general

From Balázs Klein
Subject Re: dynamic crosstab
Date
Msg-id 20080215122937.CF8F4136C7A@mail01a.mail.t-online.hu
Whole thread Raw
In response to Re: dynamic crosstab  (Erik Jones <erik@myemma.com>)
Responses Re: dynamic crosstab
List pgsql-general
Erik Jones wrote:
> First, please stop top-posting.  It makes it difficult for both me
> and others to know to whom/what you are replying.

Sorry, I don't know much about mailing list customs - I had to look up what top-posting is. I will behave now ...

I would prefer to keep the complications for when I retrieve the data rather then when I store it.

I could imagine something like this though to create a crosstab as an array, but I am afraid that there is no assurance
thatthe resulting array would contain the values in the same order for each focus: 

tbl(eID, aID, value)

Select eID, array_accum(value) from
(
 (Select Distinct eID from tbl) e
  CROSS JOIN
 (Select Distinct aID from tbl) a
) ea
 LEFT OUTER JOIN
tbl USING (eID, aID)
GROUP BY eID

B.


pgsql-general by date:

Previous
From: "Phoenix Kiula"
Date:
Subject: Re: Are indexes blown?
Next
From: Richard Huxton
Date:
Subject: Re: Are indexes blown?