Received: from oxmail.ox.ac.uk (oxmail1.ox.ac.uk [129.67.1.1]) by hub.org (8.9.3/8.9.3) with ESMTP id KAA15619 for ; Thu, 13 Apr 2000 10:53:05 -0400 (EDT) (envelope-from moray.mcconnachie@computing-services.oxford.ac.uk) Received: from ermine.ox.ac.uk ([163.1.2.13]) by oxmail.ox.ac.uk with esmtp (Exim 3.12 #3) id 12fkzD-0006E5-00; Thu, 13 Apr 2000 15:52:51 +0100 Received: from ermine.ox.ac.uk ([163.1.2.13] helo=moraypc ident=root) by ermine.ox.ac.uk with smtp (Exim 3.13 #1) id 12fkzC-0005fd-00; Thu, 13 Apr 2000 15:52:50 +0100 Message-ID: <01dc01bfa557$c42d1590$760e01a3@oucs.ox.ac.uk> From: "Moray McConnachie" To: "Andy Lewis" Cc: "Andrew Perrin - Demography" , References: Subject: Re: Subtracting from a date Date: Thu, 13 Apr 2000 15:51:35 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2919.6700 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 X-Archive-Number: 200004/144 > SELECT date_effective FROM your_table WHERE date_effective <= (now() + '3 years ago') That looks good. If date_effective is a datetime - should be date_effective::datetime if as Andrew said date_effective is a date field, I guess. Also your inequality is the wrong way round for things less than or equal to 3 years old, which is what I thought Andrew wanted. I think it's a bit faster than the age() construction, too. ---------------------------------------------------------------- Moray.McConnachie@computing-services.oxford.ac.uk