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

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: "Walker, Jed S" <Jed_Walker(at)cable(dot)comcast(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: using interval in a query with a column for the interval value?
Date: 2005-08-10 19:00:53
Message-ID: 20050810190053.GA7189@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Thu, Aug 04, 2005 at 09:52:50 -0600,
"Walker, Jed S" <Jed_Walker(at)cable(dot)comcast(dot)com> wrote:
>
> 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.

Use something like:
Where last_date < now() - Interval * '1 day'::interval

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Michael Fuhr 2005-08-11 00:25:57 Re: Transaction blocks
Previous Message Alexander Kotelnikov 2005-08-10 15:13:23 Re: Transaction blocks