Re: pgsql aggregate: conditional max

From: Weimao Ke <wke(at)indiana(dot)edu>
To: Michael Fuhr <mike(at)fuhr(dot)org>
Cc: Jeffrey Melloy <jmelloy(at)visualdistortion(dot)org>, pgsql-sql(at)postgresql(dot)org
Subject: Re: pgsql aggregate: conditional max
Date: 2006-03-12 16:55:01
Message-ID: 44145265.6030100@indiana.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Michael Fuhr wrote:

>On Sun, Mar 12, 2006 at 12:34:57AM -0500, Jeffrey Melloy wrote:
>
>
>>Should be able to do this with a standard max() aggregate.
>>
>>select aid, cat, max(weight)
>>from table
>>group by aid, cat;
>>
>>
>
>That query returns the maximum weight for each (aid, cat) pair.
>Against the example data it returns the entire table, not the
>(aid, cat) pair with the max weight for a given aid.
>
>
>
Michael is right. This query does not solve the problem...

--
All best,

Weimao

Weimao Ke
Indiana University Bloomington
School of Library and Information Science
http://ella.slis.indiana.edu/~wke

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Weimao Ke 2006-03-12 17:07:53 Re: pgsql aggregate: conditional max
Previous Message Daniel CAUNE 2006-03-12 14:05:37 Re: pgsql aggregate: conditional max