Re: Creating timestamps in queries?

From: Frank Bax <fbax(at)execulink(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Creating timestamps in queries?
Date: 2000-07-12 00:39:43
Message-ID: 3.0.6.32.20000711203943.01184100@execulink.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I think you meant:

select * from blah where stamp >= now() - '7days'::interval;

You can also try:

select * from blah where age( now(), stamp ) < '7days'::interval;

Frank

At 09:07 AM 7/11/00 +0200, you wrote:
>Hi Rob,
>
>Try this:
>
>select * from blah where stamp >= now()::date - 7;
>
>I think it should work.
>
>/Patrik Kudo
>
>On Mon, 10 Jul 2000, Rob S. wrote:
>
>> Hi all,
>>
>> I would like to say,
>>
>> "select * from blah where stamp >= 7 days ago"
>>
>> ...where the "days ago" is calculated at query time; meaning that its not
>> hardcoded into the query as a date string. Is this possible?
>
>
>

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Rob S. 2000-07-12 01:07:24 RE: Creating timestamps in queries?
Previous Message Rob S. 2000-07-11 15:45:45 RE: Change type of column