Re: Selecting the most recent date

Поиск
Список
Период
Сортировка
От Dennis Gearon
Тема Re: Selecting the most recent date
Дата
Msg-id 3EAD7114.50002@cvc.net
обсуждение исходный текст
Ответ на Selecting the most recent date  (Mark Tessier <m_tessier@sympatico.ca>)
Список pgsql-general
select (rows desired)
from tableselect
where abs( todays_date - col_date) = min( abs( todays_date - col_date));

SORT OF <LOL>, I'm not sure how to find that particular row, but is how you find the minimum difference from todays
date.

Mark Tessier wrote:
> Hi,
>
> My question is hopefully a simple one:  If I have several rows, each containing a date field, and I want to select
therow that has the date closest to today's date, what would be the syntax for carrying that out. 
>


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

Предыдущее
От: "Robert Fitzpatrick"
Дата:
Сообщение: Re: Setting a field to default if blank value
Следующее
От: Dennis Gearon
Дата:
Сообщение: Re: problems restoring 7.2.1 dump to 7.3.2