using interval in a query with a column for the interval value?

From: "Walker, Jed S" <Jed_Walker(at)cable(dot)comcast(dot)com>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: using interval in a query with a column for the interval value?
Date: 2005-08-04 15:52:50
Message-ID: 4A59B6AA01F1874283EA66C976ED51FC466412@COENGEXCMB01.cable.comcast.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I am writing a script and I need to output results to a file based on a
table where the data to select is based on a 'last' date and an
'interval'.

Essentially

Name
Last_date
Interval

Jed 2005-06-02 30
Tom 2005-08-02 30

Select name
>From table1
Where last_date < now() - [[interval days]];

The interval days part is what is stumping me I need to say "now() -
interval '30 days'" but I need to use the interval column.

How do I make this work?

Thanks,

Jed

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message operationsengineer1 2005-08-04 16:18:42 change varchar(10) to varchar()
Previous Message John J. Urbaniak 2005-08-04 14:09:42 Re: Vacuum with Views