You should deal with the datediff stuff inside the SQL so that the 
database only puts out the records you need.  Then you can output all of 
them.

Google up datediff and whatever database you are using.   
http://www.bluestarlearning.com/Default.aspx?tabid=66&articleType=ArticleView&articleId=7
  
Here's an example of a query using datediff


Nick G wrote:
> 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:2373
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