Double aggregate problem

Поиск
Список
Период
Сортировка
От David Weilers
Тема Double aggregate problem
Дата
Msg-id H00000670039e901.1248279381.lionhead2.lionhead.nl@MHS
обсуждение исходный текст
Ответы Re: Double aggregate problem  (Peter Eisentraut <peter_e@gmx.net>)
Re: Double aggregate problem  (nha <lyondif02@free.fr>)
Список pgsql-sql
Dear anyone,

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:

id |                      sector                       |
                  provincie
----+---------------------------------------------------+---------------
-------------------------------------------------------------------11 | Gaafjes, Eerder, Gaafjes, Eerder, Gaafjes,
Eerder| Noord-Holland,  

Noord-Holland, Limburg, Limburg, Oost-Vlaanderen, Oost-Vlaanderen

If i leave out one aggregate, the result is as i expect (if I leave out
'provincie', sector gives):

Gaafjes, Eeerder

Only two results.

I would like both array_accum returning only what they should and not
doubles.

Any help is appreciated.

--
Regards,

David Weilers


В списке pgsql-sql по дате отправления:

Предыдущее
От: Frank Bax
Дата:
Сообщение: Re: how to tell if column set on update
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: Double aggregate problem