pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Markus Schaber <schabi@logix-tt.com>
To: Achilleus Mantzios <achill@matrix.gatewaynet.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Ugly group by problem
Date: Wed, 29 Mar 2006 16:44:10 +0200
Message-ID: <442A9D3A.7010605@logix-tt.com> (raw)
In-Reply-To: <Pine.LNX.4.44.0603291838520.5673-100000@matrix.gatewaynet.com>
References: <Pine.LNX.4.44.0603291838520.5673-100000@matrix.gatewaynet.com>

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



view thread (5+ messages)  latest in thread

Message-ID: <442A9D3A.7010605@logix-tt.com>
Permalink:  ../442A9D3A.7010605@logix-tt.com/
Also on:    postgresql.org/message-id/442A9D3A.7010605@logix-tt.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: schabi@logix-tt.com, achill@matrix.gatewaynet.com
  Subject: Re: Ugly group by problem
  In-Reply-To: <442A9D3A.7010605@logix-tt.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox