Re: Creating timestamps in queries?

From: Patrik Kudo <kudo(at)partitur(dot)se>
To: "Rob S(dot)" <rslifka(at)home(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Creating timestamps in queries?
Date: 2000-07-11 07:07:44
Message-ID: Pine.BSF.4.21.0007110906450.27659-100000@tb303.partitur.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

Browse pgsql-sql by date

  From Date Subject
Next Message Adam Walczykiewicz 2000-07-11 07:16:19 SQL-92 SQLSTATE in PostgreSQL ?!
Previous Message Rob S. 2000-07-11 05:26:38 Creating timestamps in queries?