Re: Date Math

Поиск
Список
Период
Сортировка
От aklaver@comcast.net
Тема Re: Date Math
Дата
Msg-id 050720071708.26465.463F5D1D000937E30000676122073000339D0A900E04050E@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>
>    I've read both Section 8.5 of the on-line 8.2.4 docs, and the pertinent
> sections of Douglas & Douglas, and I'm still not certain that I'm correctly
> expressing the query I want. Please correct as needed.
>
>    From table (Permits) I want to identify those which expire within a
> specified time from today. For example:
>
>      SELECT permit_nbr, title, date_issued, term,
>          process_time from Permits
>      WHERE (date_issued + term YEARS)
>          < (CURRENT_DATE + process_time MONTHS);
>
>    Should I use TODAY rather than CURRENT_DATE? Do I need to cast intervals
> explicitly from seconds to days, months, or years?
>

Are you thinking something like the following-

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)

test=> select '01/01/04'::date +interval '3 year'<current_date + interval '2
month';
 ?column?
----------
 t
(1 row)

Adrian Klaver
aklaver@comcast.net

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

Предыдущее
От: Gregory Gimenez
Дата:
Сообщение: Large object and pg_restore problem
Следующее
От: Magnus Hagander
Дата:
Сообщение: Re: pg_ctl: could not start service "pgsql-8.2": error code 1063