Re: Date Math

Поиск
Список
Период
Сортировка
От aklaver@comcast.net (Adrian Klaver)
Тема Re: Date Math
Дата
Msg-id 050720071750.8431.463F66D400082135000020EF22073000339D0A900E04050E@comcast.net
обсуждение исходный текст
Ответ на Date Math  (Rich Shepard <rshepard@appl-ecosys.com>)
Ответы Re: Date Math  (Rich Shepard <rshepard@appl-ecosys.com>)
Список pgsql-general
 -------------- Original message ----------------------
From: Rich Shepard <rshepard@appl-ecosys.com>
> On Mon, 7 May 2007, aklaver@comcast.net wrote:
>
> > test=> select '01/01/04'::date +interval '3 year',current_date + interval
> > '2 month';
> >      ?column?       |      ?column?
> > ---------------------+---------------------
> > 2007-01-01 00:00:00 | 2007-07-07 00:00:00
> > (1 row)
>
> Adrian,
>
>    I think so, but without explicit strings. The dates and intervals are in
> the table, and I want the rows that meet the specified conditions.
>
>    Is the following closer to correct?
>
>    SELECT ... FROM Permits
>      WHERE (date_issued::DATE + INTERVAL term)
>          < (CURRENT_DATE + INTERVAL process_time + INTERVAL '2 week')
>
> Thanks,
>
> Rich

If term and process_time are stored as intervals then it will work. Also if they are stored as
INTERVALS you can do CURRENT_DATE+process_time. In other words not have to declare the
INTERVAL . Is date_issued stored as a date? If so it would not need to be cast.
--
Adrian Klaver
aklaver@comcast.net

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

Предыдущее
От: "Martin Gainty"
Дата:
Сообщение: Re: Postgre Sql 7.3 connection problem
Следующее
От: Rich Shepard
Дата:
Сообщение: Re: Date Math