From: | "Brandon Metcalf" <bmetcalf(at)nortel(dot)com> |
---|---|
To: | Martín Marqués <martin(at)bugs(dot)unl(dot)edu(dot)ar> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: query for records based on date |
Date: | 2005-02-21 20:48:00 |
Message-ID: | Pine.LNX.4.58L.0502211447320.24449@cash.rhiamet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
m == martin(at)bugs(dot)unl(dot)edu(dot)ar writes:
m> El Lun 21 Feb 2005 17:00, Brandon Metcalf escribi:
m> > If I have a table with an attribute of type "timestamp without time
m> > zone", what is the best way to query that table for records that are
m> > older than, say, one week.
m> >
m> > I suppose I could get the current time in epoch seconds and the time of
m> > the attribute in the same, and select those records where the difference
m> > is greater than the number of seconds in a week. Is there something
m> > easier like
m> >
m> > SELECT * FROM table WHERE attribute IS OLDER THAN one week;
m> SELECT * FROM table WHERE attribute < (now()::DATE - 7)::TIMESTAMP;
Thanks.
--
Brandon
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Huxton | 2005-02-21 20:53:25 | Re: query for records based on date |
Previous Message | Martín Marqués | 2005-02-21 20:42:54 | Re: query for records based on date |