Re: Selecting the most recent date

Поиск
Список
Период
Сортировка
От Jeff Eckermann
Тема Re: Selecting the most recent date
Дата
Msg-id 20030428190700.50580.qmail@web20809.mail.yahoo.com
обсуждение исходный текст
Ответ на Selecting the most recent date  (Mark Tessier <m_tessier@sympatico.ca>)
Список pgsql-general
--- Mark Tessier <m_tessier@sympatico.ca> wrote:
> Hi,
>
> My question is hopefully a simple one:  If I have
> several rows, each containing a date field, and I
> want to select the row that has the date closest to
> today's date, what would be the syntax for carrying
> that out.
>
select * from tablename order by abs(current_date -
datefield) desc limit 1;

__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com


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

Предыдущее
От: Sergio Pili
Дата:
Сообщение: Error: No one parent tuple was found
Следующее
От: "Jimmie H. Apsey"
Дата:
Сообщение: Re: Postgres client/server parameters?