hmm.. think i cant do that... coz.. thats will oso return 6 yrs 7 yrs.. blah.... hmm.. anyway... i think i got it... thats a datepart in sqlsever oso... i can use datepart to chk the yr in orderdate = (current yr -5) hope that can work.. havnt try that out...
thanx anyway pal!!: ) cheers han ----- Original Message ----- From: "Paul Giesenhagen" <[EMAIL PROTECTED]> To: "CF-Talk" <[EMAIL PROTECTED]> Sent: Friday, March 22, 2002 12:47 PM Subject: Re: how to retrieving data by age of record in MSSQL > <!--- 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 > > > > > ______________________________________________________________________ This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. 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

