X-Original-To: pgsql-sql@postgresql.org Received: from localhost (unknown [64.117.224.193]) by developer.postgresql.org (Postfix) with ESMTP id C018B92504D for ; Tue, 20 May 2003 12:22:43 -0400 (EDT) Received: from developer.postgresql.org ([64.117.224.193]) by localhost (developer.postgresql.org [64.117.224.193:10024]) (amavisd-new) with ESMTP id 07597-04 for ; Tue, 20 May 2003 12:22:40 -0400 (EDT) Received: from hotmail.com (f46.law11.hotmail.com [64.4.17.46]) by developer.postgresql.org (Postfix) with ESMTP id 1512A925044 for ; Tue, 20 May 2003 12:22:40 -0400 (EDT) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Tue, 20 May 2003 09:22:39 -0700 Received: from 213.185.212.126 by lw11fd.law11.hotmail.msn.com with HTTP; Tue, 20 May 2003 16:22:38 GMT X-Originating-IP: [213.185.212.126] X-Originating-Email: [jan_bodey@hotmail.com] From: "Jan Bodey" To: pgsql-sql@postgresql.org Subject: Date comparison question Date: Tue, 20 May 2003 17:22:38 +0100 Mime-Version: 1.0 Content-Type: text/plain; format=flowed Message-ID: X-OriginalArrivalTime: 20 May 2003 16:22:39.0231 (UTC) FILETIME=[080730F0:01C31EEC] X-Virus-Scanned: by amavisd-new X-Archive-Number: 200305/389 X-Sequence-Number: 13554 Hi I require a query that will see if a stored date is more than a certain interval before the current date. Using an interval of 10 hours, the query would be something like: SELECT * FROM utable WHERE now() - utimestamp > interval '10 hours'; The problem I am having is that the interval is not fixed, and I would like to be able to store it as a value in a database table. The unit of the interval can, however, be fixed, and will almost certainly be fixed to hours. I have not been able to find a way of doing what I require, does anybody have any ideas to what I need to do? Cheers. Jan. _________________________________________________________________ Tired of 56k? Get a FREE BT Broadband connection http://www.msn.co.uk/specials/btbroadband