<!--- get todays date --->
<cfset todayDate = #Now()#>
<!--- Use the DateAdd function to subtract 5 years from today --->
<cfset variables.olddate = #DateAdd(yyyy, -5, todayDate)#>
<!--- run the query with the less than --->
<cfquery....>
select columnames
from tablename
where orderdate < #variables.olddate#
</cfquery>
that should do ya up!
Paul Giesenhagen
QuillDesign
http://www.quilldesign.com
SiteDirector v2.0 - Commerce Builder
----- Original Message -----
From: "han peng" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Thursday, March 21, 2002 10:48 PM
Subject: how to retrieving data by age of record in MSSQL
> hihi..all gurus.. i know this is not appropriate here... sorry to bother u
all....
> i need to write a query to retrieve existing records by age of the
records..
>
>
> eg. user want to see Sales orders that are 5 yrs old..
>
> so i need to write a query to retrieve from sales table.. where theres a
orderdate column int it..
> datatype is datetime.
>
> so how am i going to write the query in mssql..??
> oracle can use trunc() .. but mssql dont hav that... :(
>
> help help..
>
> hanpeng
>
>
______________________________________________________________________
Your ad could be here. Monies from ads go to support these lists and provide more
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists