Try this:

WHERE DATEDIFF("d", estarttime, NOW()) >= 7

HTH!

Scott

> -----Original Message-----
> From: Angel Stewart [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, April 01, 2003 9:12 AM
> To: CF-Talk
> Subject: SQL: Deleting items older than 7 days from today
> 
> 
> Hey all,
> 
> I'm trying to do this with a single SQL statement.
> 
> Delete all records from the table tblEvents that are older 
> than 7 days.
> 
> :)
> 
> This is the code I tried using:
> 
> <CFQUERY name="DE" Datasource="#DSN#">
> 
>       Select * FROM tblEvents
>       WHERE Now() - estarttime >= 7 
>       
> </CFQUERY>
> 
> <CFDUMP var="#DE#">
> 
> <CFQUERY name="DE2" Datasource="#DSN#">
> 
>       Select * FROM tblEvents
>       WHERE #DateDiff('dd',Now(),estarttime)# GTE 7
>       
> </CFQUERY>
> 
> <CFDUMP VAR="#DE2#">
> 
> The first query works fine...the second one throws an error:
> 
> "Error Diagnostic Information
> 
> An error occurred while evaluating the expression: 
> 
> #DateDiff('dd',Now(),estarttime)#
> 
> Error near line 19, column 9.
> 
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to