From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alex Page <alex.page@solid-state-logic.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Problem with aggregate functions and GROUP BY
Date: Wed, 08 Aug 2001 13:26:47 -0400
Message-ID: <2091.997291607@sss.pgh.pa.us> (raw)
In-Reply-To: <02ac01c12025$78644300$7fc472c1@solidstatelogic.com>
References: <02ac01c12025$78644300$7fc472c1@solidstatelogic.com>
"Alex Page" <alex.page@solid-state-logic.com> writes:
> I'm trying to write a query that returns the rows containing the
> most recent values for each foreign key.
The best way to do this (on every dimension except portability :-()
is SELECT DISTINCT ON. See the weather-report example in the SELECT
reference page.
regards, tom lane
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: tgl@sss.pgh.pa.us, alex.page@solid-state-logic.com
Subject: Re: Problem with aggregate functions and GROUP BY
In-Reply-To: <2091.997291607@sss.pgh.pa.us>
* 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