Re: GROUP BY and aggregate functions

From: Henry House <hajhouse(at)houseag(dot)com>
To: Stoffel van Aswegen <Stoffelva(at)gmsi(dot)co(dot)za>
Cc: "PostgreSQL Mailing List (E-mail)" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: GROUP BY and aggregate functions
Date: 2001-07-16 15:53:07
Message-ID: 20010716085307.B2118@houseag.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Mon, Jul 16, 2001 at 03:30:37PM +0200, Stoffel van Aswegen wrote:
> You have to join a sub-select (or temp table) which has the Max() criteria.
> eg:
>
> T1
> ----
> ID
> Field1
> Field2
> ...
>
>
> SELECT *
> FROM T1
> JOIN (
> SELECT MAX(Field1) from T1 GROUP BY ID
> ) X
> ON x.ID = T1.ID

Ah, with a subselect it works much better :-). Thanks.

--
Henry House
OpenPGP key available from http://romana.hajhouse.org/hajhouse.asc

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2001-07-16 16:18:14 Re: GROUP BY and aggregate functions
Previous Message Dorin Grunberg 2001-07-16 15:48:33 Re: consistant output for type interval