pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Brandon Metcalf <bmetcalf@nortel.com>
To: pgsql-sql@postgresql.org
Subject: query for records based on date
Date: Mon, 21 Feb 2005 14:00:06 -0600 (CST)
Message-ID: <Pine.LNX.4.58L.0502211356580.24449@cash.rhiamet.com> (raw)

If I have a table with an attribute of type "timestamp without time
zone", what is the best way to query that table for records that are
older than, say, one week.

I suppose I could get the current time in epoch seconds and the time of
the attribute in the same, and select those records where the difference
is greater than the number of seconds in a week.  Is there something
easier like

  SELECT * FROM table WHERE attribute IS OLDER THAN one week;

Thanks.

-- 
Brandon



view thread (4+ messages)  latest in thread

Message-ID: <Pine.LNX.4.58L.0502211356580.24449@cash.rhiamet.com>
Permalink:  ../Pine.LNX.4.58L.0502211356580.24449@cash.rhiamet.com/
Also on:    postgresql.org/message-id/Pine.LNX.4.58L.0502211356580.24449@cash.rhiamet.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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: bmetcalf@nortel.com
  Subject: Re: query for records based on date
  In-Reply-To: <Pine.LNX.4.58L.0502211356580.24449@cash.rhiamet.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