From: | nha <lyondif02(at)free(dot)fr> |
---|---|
To: | David Weilers <david(at)lionhead(dot)nl> |
Cc: | PgSQL-sql <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Double aggregate problem |
Date: | 2009-07-23 01:23:40 |
Message-ID: | 4A67BB9C.2040707@free.fr |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Hello,
Le 22/07/09 20:04, Peter Eisentraut a écrit :
> On Wednesday 22 July 2009 19:16:21 David Weilers wrote:
>> I have the following query:
>>
>> select v.id, array_to_string(array_accum(s.name),', ') as sector ,
>> array_to_string(array_accum(p.name),', ') as provincie from tblvacature
>> v, tblaccount a , tblvacaturesector vs, tblsector s ,
>> tblvacatureprovincie vp, tblprovincie p where v.id = 11 and v.account =
>> a.id and vs.vacature = v.id and s.id = vs.sector and vp.vacature = v.id
>> and p.id = vp.provincie group by v.id, v.inserted order by v.inserted
>> desc
>>
>> That currently produces the following output:
>
> No one is going to be able to reproduce that without the table definitions and
> data.
>
Peter Eisentraut is right... The rewritten query I suggested is only
derived from your original query and implicit data definitions
(including constraints).
I would like to point 2 things about that rewritten proposed query:
- Column 'inserted' is likely missing in the 2nd subquery and in the
global join condition;
- Duplicity or even multiplicity of value s.name and/or p.name may
result depending on the keys of tables (as implicitly mentioned by Peter
Eisentraut).
Regards.
--
nha / Lyon / France.
From | Date | Subject | |
---|---|---|---|
Next Message | nha | 2009-07-23 01:42:04 | Re: how to tell if column set on update |
Previous Message | Peter Eisentraut | 2009-07-22 18:04:34 | Re: Double aggregate problem |