Re: Aggregate

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: David Wheeler <david(at)kineticode(dot)com>
Cc: <sfpug(at)postgresql(dot)org>
Subject: Re: Aggregate
Date: 2003-03-03 21:08:48
Message-ID: 20030303130732.M41677-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: sfpug


Replying to myself because I forgot that both versions need the gp.value<4
check removed, not just the distinct on one... :(

On Mon, 3 Mar 2003, Stephan Szabo wrote:

> select a.id from ...
> where ...
> group by a.id
> having max(gp.value)<4;
>
> select id from
> (select distinct on (a.id) a.id, gp.value
> from ...
> where ... -- [minus the gp.value check]
> order by a.id, gp.value desc
> ) foo
> where value<4;

In response to

Browse sfpug by date

  From Date Subject
Next Message Josh Berkus 2003-03-03 21:33:21 Re: Aggregate
Previous Message David Fetter 2003-03-03 21:07:51 Re: Aggregate