From: | Balázs Klein <Balazs(dot)Klein(at)t-online(dot)hu> |
---|---|
To: | "'Erik Jones'" <erik(at)myemma(dot)com> |
Cc: | "'Tino Wildenhain'" <tino(at)wildenhain(dot)de>, <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: dynamic crosstab |
Date: | 2008-02-15 12:29:37 |
Message-ID: | 20080215122937.CF8F4136C7A@mail01a.mail.t-online.hu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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 that the 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.
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Huxton | 2008-02-15 12:40:38 | Re: Are indexes blown? |
Previous Message | Phoenix Kiula | 2008-02-15 12:26:23 | Re: Are indexes blown? |