Re: Temporal query question

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: Temporal query question
Дата
Msg-id 41AC56D6.1000000@archonet.com
обсуждение исходный текст
Ответ на Temporal query question  ("Stefano Bonnin" <stefano.bonnin@comai.to>)
Ответы Re: Temporal query question  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Stefano Bonnin wrote:
> Hi all,
>
> I have a "simple" question about the following temporal query with
> "interval" operator:
>
> can I define a query of this type?
>
> select myfield,numeric_field from mytable where temporal_attribute <
> temporal_attribute - interval numeric_field || ' days'
>
> obviously this syntax is wrong.

Not by much:

SELECT now() - (1 || ' days')::interval;

You could use CAST(...) instead of course, and a date plus/minus an
integer defaults to days.

--
   Richard Huxton
   Archonet Ltd

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

Предыдущее
От: Richard Huxton
Дата:
Сообщение: Re: change natural column order
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: Maximum limit on int in plpgsql