Sandy, thanks for your reply. Your suggestion looks like it should be a more 
efficient way to get what I am after. I will play around with that. Thanks for 
your time.

       Nick


>You can use something like this in your query itself..(Please check
>syntax for MS Access.)
>
>Select * from employee where DateDiff ("yyyy", DOS, getDate()) = 20
>
>Thanks.
>
>-Sandy Vohra
>
>-----Original Message-----
>From: Nick G [mailto:[EMAIL PROTECTED] 
>Sent: Thursday, December 28, 2006 1:21 PM
>To: CF-Newbie
>Subject: Date Comparisons
>
>I am trying to select a date field (stored in MS Access in this format
>9/14/1997) and compare that with the current year. If the differece in
>years between the two dates is 20, that record needs to be selected.
>There are several thousand records which need to be queried. How will I
>be able to make the comparison and store/output the records which meet
>the criteria? I was dabbling with the 
>datediff(datepart, date1, date2) function but not getting the proper
>results. Here is thy syntax (roughly):
>
><cfquery name="r" datasource="DB">
>Select * From Employees
></cfquery>
>
><cfset TDate=Now()>
>
><cfloop query="r">
><cfif DateDiff(yyyy, #r.DOS#, #DateFormat(TDate, "dd/mm/yyyy"#) = 20>
><cfoutput>#r.Name#<br /></cfoutput>
></cfloop>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Newbie/message.cfm/messageid:2370
Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15

Reply via email to