Re: pgsql aggregate: conditional max

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: pgsql aggregate: conditional max
Дата
Msg-id 20060312054854.GA25553@winnie.fuhr.org
обсуждение исходный текст
Ответ на Re: pgsql aggregate: conditional max  (Jeffrey Melloy <jmelloy@visualdistortion.org>)
Ответы Re: pgsql aggregate: conditional max  (Weimao Ke <wke@indiana.edu>)
Список pgsql-sql
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 Fuhr


В списке pgsql-sql по дате отправления:

Предыдущее
От: Michael Fuhr
Дата:
Сообщение: Re: pgsql aggregate: conditional max
Следующее
От: Daniel CAUNE
Дата:
Сообщение: Re: pgsql aggregate: conditional max