Re: Temporal query question

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: Temporal query question
Дата
Msg-id 20041130111230.GA30959@svana.org
обсуждение исходный текст
Ответ на Temporal query question  ("Stefano Bonnin" <stefano.bonnin@comai.to>)
Список pgsql-general
The usual syntax is something like:

select myfield,numeric_field
from mytable
where temporal_attribute_a < temporal_attribute_b - ( numeric_field * '1 day'::interval);

One of the temporal_attributes tends to be 'now' or 'today' but the
principle is the same...

On Tue, Nov 30, 2004 at 11:30:16AM +0100, 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.
> In other words, is there a way to define a query with a interval operator with variable argument?
> Thanks
> Stefano
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Вложения

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

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