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.