Search Postgresql Archives

Re: date problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



# tony@xxxxxxxx / 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

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux