pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Frank Bax <fbax@execulink.com>
To: pgsql-sql@postgresql.org
Subject: Re: Creating timestamps in queries?
Date: Tue, 11 Jul 2000 20:39:43 -0400
Message-ID: <3.0.6.32.20000711203943.01184100@execulink.com> (raw)
In-Reply-To: <Pine.BSF.4.21.0007110906450.27659-100000@tb303.partitur.se >
References: <001c01bfeaf8$96812be0$39117118@rct1.bc.wave.home.com>

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?
>
>
>



view thread (4+ messages)  latest in thread

Message-ID: <3.0.6.32.20000711203943.01184100@execulink.com>
Permalink:  ../3.0.6.32.20000711203943.01184100@execulink.com/
Also on:    postgresql.org/message-id/3.0.6.32.20000711203943.01184100@execulink.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: fbax@execulink.com
  Subject: Re: Creating timestamps in queries?
  In-Reply-To: <3.0.6.32.20000711203943.01184100@execulink.com>
  References: <001c01bfeaf8$96812be0$39117118@rct1.bc.wave.home.com> <3.0.6.32.20000711203943.01184100@execulink.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox