From: | Erik Jones <erik(at)myemma(dot)com> |
---|---|
To: | Balázs Klein <Balazs(dot)Klein(at)t-online(dot)hu> |
Cc: | "'Tino Wildenhain'" <tino(at)wildenhain(dot)de>, <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: dynamic crosstab |
Date: | 2008-02-15 16:01:24 |
Message-ID: | CE79DDB5-AD55-4F8D-9798-947085D38B67@myemma.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Feb 15, 2008, at 9:56 AM, Balázs Klein wrote:
>> given that answers for a questionnaire are stored as a
>> batch
>
> Not in our setup - for all sorts of reasons (preserving responses
> on a connection failure or restart, monitoring response latency in
> real time, creating adaptive/branching questionnaires) we send each
> response separately.
>
>> people running reports on will be the ones to notice, i.e. at
>> retrieval time.
>
> I am not sure - different responses are aggregated into different
> attributes in different ways - those properties need to be
> retrieved during scoring/report generation, so being able to create
> a join directly on a response is a good thing for me. But report
> generation - in our case it must be a DTP quality PDF - is such a
> beast anyway that db times dwarf compared to pdf generation.
>
> The problem comes when I need to present the responses themselves
> in a human-friendly way - as an export or display or report. Do you
> think there is a way to ensure that the order of the values in the
> array below is the same for each person?
>
> 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
The only way to ever guarantee a particular order is via an ORDER BY
clause.
Erik Jones
DBA | Emma®
erik(at)myemma(dot)com
800.595.4401 or 615.292.5888
615.292.0777 (fax)
Emma helps organizations everywhere communicate & market in style.
Visit us online at http://www.myemma.com
From | Date | Subject | |
---|---|---|---|
Next Message | Tony Caduto | 2008-02-15 16:21:38 | Re: Pains in upgrading to 8.3 |
Previous Message | Balázs Klein | 2008-02-15 15:59:41 | Re: dynamic crosstab |