From: Tom Lane <tgl@sss.pgh.pa.us>
To: Steve Meynell <steve@candata.com>
Cc: Postgresql Mailing List <pgsql-sql@postgresql.org>
Subject: Re: Help Retrieving Latest Record
Date: Fri, 16 Feb 2001 16:00:56 -0500
Message-ID: <13700.982357256@sss.pgh.pa.us> (raw)
In-Reply-To: <3A8D3C04.3D81B5BA@candata.com>
References: <3A8D3C04.3D81B5BA@candata.com>
Steve Meynell <steve@candata.com> writes:
> select * from basket where max(date) and fruit='Apples';
> I know this doesn't work but I need something like it.
Perhaps
select * from basket where fruit='Apples'
order by date desc
limit 1;
The limit clause is not standard SQL, but it's a pretty easy answer
if portability doesn't bother you...
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, steve@candata.com
Subject: Re: Help Retrieving Latest Record
In-Reply-To: <13700.982357256@sss.pgh.pa.us>
References: <3A8D3C04.3D81B5BA@candata.com> <13700.982357256@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