Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

sfpug by date

Next:From: Josh BerkusDate: 2003-03-03 21:33:21
Subject: Re: Aggregate
Previous:From: David FetterDate: 2003-03-03 21:07:51
Subject: Re: Aggregate

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group