----- Original Message -----
From: "Ewok" <[EMAIL PROTECTED]>
> I've been trying to write a query to delete records older than 24 hours. I
> can do it with a loop and a var, but I'm sure there is a way to do it with
a
> single query statement.
----------------------------

How about:

<cfquery name="purge" datasource="#request.DB_DSN#"
dbtype="#request.DB_type#">
  DELETE FROM tab
  WHERE  dateJoined < <cfqueryparam
value="#CreateODBCDateTime(DateAdd('h', -24, Now()))#"
cfsqltype="CF_SQL_DATE">
</cfquery>

Gyrus
[EMAIL PROTECTED]
work: http://www.tengai.co.uk
play: http://norlonto.net
PGP key available

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm

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

Reply via email to