Re: date problem

Поиск
Список
Период
Сортировка
От Roman Neuhauser
Тема Re: date problem
Дата
Msg-id 20050516083055.GA46490@isis.sigpipe.cz
обсуждение исходный текст
Ответ на date problem  (tony <tony@tgds.net>)
Ответы Re: date problem  (tony <tony@tgds.net>)
Список pgsql-general
# tony@tgds.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

В списке pgsql-general по дате отправления:

Предыдущее
От: tony
Дата:
Сообщение: date problem
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: date problem