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:2368 Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15
