X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6BBCE8B9C51 for ; Mon, 21 Feb 2005 20:00:20 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 08512-07 for ; Mon, 21 Feb 2005 20:00:18 +0000 (GMT) Received: from zcars04f.nortelnetworks.com (zcars04f.nortelnetworks.com [47.129.242.57]) by svr1.postgresql.org (Postfix) with ESMTP id E5B938B9C03 for ; Mon, 21 Feb 2005 20:00:18 +0000 (GMT) Received: from zrtps0m6.us.nortel.com (zrtps0m6.us.nortel.com [47.140.192.58]) by zcars04f.nortelnetworks.com (Switch-2.2.6/Switch-2.2.0) with ESMTP id j1LK0GB21052 for ; Mon, 21 Feb 2005 15:00:16 -0500 (EST) Received: from cash.rhiamet.com (rhiamet.us.nortel.com [47.103.243.53]) by zrtps0m6.us.nortel.com (Switch-2.2.6/Switch-2.2.0) with ESMTP id j1LK0EH16048 for ; Mon, 21 Feb 2005 15:00:14 -0500 (EST) Received: from cash.rhiamet.com (bmetcalf@localhost [127.0.0.1]) by cash.rhiamet.com (8.12.11/8.12.11/Debian-3) with ESMTP id j1LK07a6031546 for ; Mon, 21 Feb 2005 14:00:07 -0600 Received: from localhost (bmetcalf@localhost) by cash.rhiamet.com (8.12.11/8.12.11/Debian-3) with ESMTP id j1LK06I1031542 for ; Mon, 21 Feb 2005 14:00:07 -0600 X-Authentication-Warning: cash.rhiamet.com: bmetcalf owned process doing -bs Date: Mon, 21 Feb 2005 14:00:06 -0600 (CST) From: "Brandon Metcalf" X-X-Sender: bmetcalf@cash.rhiamet.com To: pgsql-sql@postgresql.org Subject: query for records based on date Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200502/226 X-Sequence-Number: 20337 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