From: Michael Fuhr <mike@fuhr.org>
To: Kaloyan Iliev Iliev <news1@faith.digsys.bg>
Cc: pgsql-sql@postgresql.org
Subject: Re: Problems with HAVING
Date: Wed, 12 Jan 2005 10:11:21 -0700
Message-ID: <20050112171121.GA94838@winnie.fuhr.org> (raw)
In-Reply-To: <41E5529B.9030609@faith.digsys.bg>
References: <41E5529B.9030609@faith.digsys.bg>
On Wed, Jan 12, 2005 at 06:38:51PM +0200, Kaloyan Iliev Iliev wrote:
> My problem is that I want to select the row with max(date) but also
> limited with where clauses.
If you don't mind using a non-standard feature then try SELECT
DISTINCT ON (not just DISTINCT, but DISTINCT ON):
http://www.postgresql.org/docs/7.4/static/sql-select.html#SQL-DISTINCT
--
Michael Fuhr
http://www.fuhr.org/~mfuhr/
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: mike@fuhr.org, news1@faith.digsys.bg
Subject: Re: Problems with HAVING
In-Reply-To: <20050112171121.GA94838@winnie.fuhr.org>
* 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