Received: from oxmail.ox.ac.uk (oxmail4.ox.ac.uk [163.1.2.33]) by hub.org (8.9.3/8.9.3) with ESMTP id FAA43914 for ; Thu, 13 Apr 2000 05:29:47 -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 #1) id 12ffwR-0006nG-00; Thu, 13 Apr 2000 10:29:39 +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 12ffwR-0007rL-00; Thu, 13 Apr 2000 10:29:39 +0100 Message-ID: <007f01bfa52a$9f591c50$760e01a3@oucs.ox.ac.uk> From: "Moray McConnachie" To: "Andrew Perrin - Demography" , References: Subject: Re: Subtracting from a date Date: Thu, 13 Apr 2000 10:28:26 +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/140 WHERE age('now',date_effective::datetime)<='3 years'::timespan I don't know if 'now' in that context is still the authoritative way to write now, maybe it should be WHERE age(now(),date_effective::datetime)<='3 years'::timespan if date_effective is actually a datetime field, which I understand we are moving to in 7.0 (date fields being non-SQL-standard), then you don't need the cast, obviously. ---------------------------------------------------------------- Moray.McConnachie@computing-services.oxford.ac.uk ----- Original Message ----- From: "Andrew Perrin - Demography" To: Sent: Wednesday, April 12, 2000 6:46 PM Subject: [SQL] Subtracting from a date > I need to find all records with a date field (date_effective) 3 years or > less prior to now(). This clearly must be possible, but I'm not figuring > it out. Any suggestions? > > --------------------------------------------------------------------- > Andrew J. Perrin - aperrin@demog.berkeley.edu - NT/Unix Admin/Support > Department of Demography - University of California at Berkeley > 2232 Piedmont Avenue #2120 - Berkeley, California, 94720-2120 USA > http://demog.berkeley.edu/~aperrin --------------------------SEIU1199 > >