Re: Problems with HAVING

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Kaloyan Iliev Iliev <news1(at)faith(dot)digsys(dot)bg>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Problems with HAVING
Date: 2005-01-12 17:11:21
Message-ID: 20050112171121.GA94838@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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/

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Michael Fuhr 2005-01-12 17:17:56 Re: Syntax error while altering col-type
Previous Message KÖPFERL Robert 2005-01-12 17:02:10 Syntax error while altering col-type