Re: Ugly group by problem

Поиск
Список
Период
Сортировка
От Markus Schaber
Тема Re: Ugly group by problem
Дата
Msg-id 442A9D3A.7010605@logix-tt.com
обсуждение исходный текст
Ответ на Re: Ugly group by problem  (Achilleus Mantzios <achill@matrix.gatewaynet.com>)
Ответы Re: Ugly group by problem  (Achilleus Mantzios <achill@matrix.gatewaynet.com>)
Список pgsql-sql
Hi, Achilleus,

Achilleus Mantzios wrote:

> foodb=# SELECT qoo.foo2,sum(qoo.foo3) from (SELECT mt.link_id as 
> foo,_int_union(array(select mt2.feat_id from markustest mt2 where 
> mt2.link_id=mt.link_id order by mt2.feat_id),'{}') as foo2,other::int4 as 
> foo3 from markustest mt) as qoo GROUP BY qoo.foo2;
>   foo2  | sum
> --------+-----
>  {2}    |   1
>  {5,23} |  13
>  {23}   |  14
> (3 rows)

This is much like I intended to do it, but using "select distinct" in
the inner select as I don't have _int_union here, and using a temporary
table to collect the sets of link ids.

Markus


-- 
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org


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

Предыдущее
От: Achilleus Mantzios
Дата:
Сообщение: Re: Flight numbers data
Следующее
От: Achilleus Mantzios
Дата:
Сообщение: Re: Ugly group by problem