Fun with Dates

Поиск
Список
Период
Сортировка
Искать
От
Mark Fenbers
Тема
Fun with Dates
Дата
Msg-id
508F0576.4020404@noaa.gov
Список
Дерево обсуждения
Fun with Dates Mark Fenbers <mark.fenbers@noaa.gov>
Re: Fun with Dates Thomas Kellerer <spam_eater@gmx.net>
Re: Fun with Dates Mark Fenbers <mark.fenbers@noaa.gov>
 Greetings,

I want to be able to select all data going back to the beginning of the current month.  The following portion of an SQL does NOT work, but more or less describes what I want...

... WHERE obstime >= NOW() - INTERVAL (SELECT EXTRACT (DAY FROM NOW() ) ) + ' days'

In other words, if today is the 29th of the month, I want to select data that is within 29 days old... WHERE obstime >= NOW() - INTERVAL '29 days'

How do I craft a query to do use a variable day of the month?

Mark
В списке pgsql-sql по дате отправления
От: David Johnston
Дата:
От: Thomas Kellerer
Дата:
Сообщение: Re: Fun with Dates
FAQ