RE: Creating timestamps in queries?

From: "Rob S(dot)" <rslifka(at)home(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: RE: Creating timestamps in queries?
Date: 2000-07-12 01:07:24
Message-ID: 001701bfeb9d$89c44f40$39117118@rct1.bc.wave.home.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

My friends, you are truly life-savers. Thanks very much!

How on Earth do you know this stuff? =) I saw all of these in the User's
Guide (re: now(), interval keyword, etc.), but in no way would figure this
was how they were put together!

Aside from the few in the FAQ, is there a list of commonly-done queries?
There are some for SELECT and whatnot, but maybe asking for that for these
far-out ones is too much.

Thanks again all ;)

- A very grateful Rob Slifka

> -----Original Message-----
> From: pgsql-sql-owner(at)hub(dot)org [mailto:pgsql-sql-owner(at)hub(dot)org]On Behalf
> Of Frank Bax
> Sent: July 11, 2000 5:40 PM
> To: pgsql-sql(at)postgresql(dot)org
> Subject: Re: [SQL] Creating timestamps in queries?
>
>
> 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

Browse pgsql-sql by date

  From Date Subject
Next Message Toshihide Tony Nakamura 2000-07-12 02:44:27 Re: Supported Encoding
Previous Message Frank Bax 2000-07-12 00:39:43 Re: Creating timestamps in queries?