pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Weimao Ke <wke@indiana.edu>
To: Michael Fuhr <mike@fuhr.org>
Cc: Jeffrey Melloy <jmelloy@visualdistortion.org>
Cc: pgsql-sql@postgresql.org
Subject: Re: pgsql aggregate: conditional max
Date: Sun, 12 Mar 2006 11:55:01 -0500
Message-ID: <44145265.6030100@indiana.edu> (raw)
In-Reply-To: <20060312054854.GA25553@winnie.fuhr.org>
References: <4413AD1C.9050604@indiana.edu>
	<4413B301.7070207@visualdistortion.org>
	<20060312054854.GA25553@winnie.fuhr.org>

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




view thread (9+ messages)  latest in thread

Message-ID: <44145265.6030100@indiana.edu>
Permalink:  ../44145265.6030100@indiana.edu/
Also on:    postgresql.org/message-id/44145265.6030100@indiana.edu

 · 

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: wke@indiana.edu, mike@fuhr.org, jmelloy@visualdistortion.org
  Subject: Re: pgsql aggregate: conditional max
  In-Reply-To: <44145265.6030100@indiana.edu>

* 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