Re: Subtracting from a date

Поиск
Список
Период
Сортировка
От Moray McConnachie
Тема Re: Subtracting from a date
Дата
Msg-id 01dc01bfa557$c42d1590$760e01a3@oucs.ox.ac.uk
обсуждение исходный текст
Ответ на Re: Subtracting from a date  (Andy Lewis <alewis@recruitersonline.com>)
Список pgsql-sql
> SELECT date_effective FROM your_table WHERE date_effective <= (now() + '3
years ago')

That looks good.
If date_effective is a datetime - should be date_effective::datetime if as
Andrew said date_effective is a date field, I guess.
Also your inequality is the wrong way round for things less than or equal to
3 years old, which is what I thought Andrew wanted.

I think it's a bit faster than the age() construction, too.

----------------------------------------------------------------
Moray.McConnachie@computing-services.oxford.ac.uk



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

Предыдущее
От: "Andrew C.R. Martin"
Дата:
Сообщение: GROUP BY / HAVING - am I being thick?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: GROUP BY / HAVING - am I being thick?