Re: date problem

From: Roman Neuhauser <neuhauser(at)sigpipe(dot)cz>
To: tony <tony(at)tgds(dot)net>
Cc: postgres list <pgsql-general(at)postgresql(dot)org>
Subject: Re: date problem
Date: 2005-05-16 08:30:55
Message-ID: 20050516083055.GA46490@isis.sigpipe.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

# tony(at)tgds(dot)net / 2005-05-16 09:48:08 +0200:
> I am attempting to select records where one of the dates is the latest
> date before today
>
> select max(date) from expo where date < now()
>
> works for one record but other fields I need must be in aggregate or
> grouped. Is there a simple SQL request to get the most recent records
> from a set of joined tables?

select *
from expo
where date = (select max(date)
from expo
where date < now()) as x;

--
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man. You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Margus Roo 2005-05-16 08:43:09 is in postgres solution
Previous Message tony 2005-05-16 07:48:08 date problem