pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
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:41:30 -0700
Message-ID: <20050112174130.GA95306@winnie.fuhr.org> (raw)
In-Reply-To: <20050112171121.GA94838@winnie.fuhr.org>
References: <41E5529B.9030609@faith.digsys.bg>
	<20050112171121.GA94838@winnie.fuhr.org>

On Wed, Jan 12, 2005 at 10:11:21AM -0700, Michael Fuhr wrote:
> 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):

Sorry, I probably didn't read your message closely enough.  If you
just want a single record then ORDER BY ... LIMIT 1 might be more
appropriate.

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/



view thread (6+ messages)  latest in thread

Message-ID: <20050112174130.GA95306@winnie.fuhr.org>
Permalink:  ../20050112174130.GA95306@winnie.fuhr.org/
Also on:    postgresql.org/message-id/20050112174130.GA95306@winnie.fuhr.org

 · 

reply

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: <20050112174130.GA95306@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