Darn it... I'm pretty sure I did this while working for a previous employer, if only I could remember how...
Is simply hitting the DB again out of the question? On Tue, Mar 11, 2008 at 4:00 PM, Che Vilnonis <[EMAIL PROTECTED]> wrote: > Yes, I did. I even tried using the CAST function. No luck either way. > > -----Original Message----- > From: Sonny Savage [mailto:[EMAIL PROTECTED] > Sent: Tuesday, March 11, 2008 3:56 PM > To: CF-Talk > Subject: Re: QofQ Date Comparison Problem... > > Did you try 'YYYY-MM-DD'? > > <cfquery name="filteredArt" dbtype="query"> select name from getArt > where type = 'file' and > datelastmodified > '#dateFormat(threeMonthsAgo, > "YYYY-MM-DD")#' > </cfquery> > > On Tue, Mar 11, 2008 at 3:54 PM, Che Vilnonis <[EMAIL PROTECTED]> wrote: > > > Point #1. True. I guess I thought it was obvious. > > Points #2&3... I've tried that. I get the following... > > > > Error Executing Database Query. > > <br><b>Query Of Queries syntax error.</b><br> Encountered "2007" at > > line 0, column 0. > > > > -----Original Message----- > > On Tue, Mar 11, 2008 at 12:37 PM, Che Vilnonis <[EMAIL PROTECTED]> wrote: > > > How can I compare dates in a QofQ date comparison? See code snippet > > below. > > > Thanks, Che > > > > > > <cfset threeMonthsAgo = dateformat(dateAdd("m", -3, now()), > > > "m/d/yyyy")> <cfset dirArt = ExpandPath("../") & "emailblast"> > > > > > > <cfdirectory > > > action="LIST" > > > directory="#dirArt#" > > > name="getArt" > > > filter="*.jpg"> > > > > > > <cfquery name="filteredArt" dbtype="query"> select name from getArt > > > where type = 'file' and > > > datelastmodified > <cfqueryparam > > value="#threeMonthsAgo#" > > > cfsqltype="CF_SQL_DATE"> > > > </cfquery> > > > > > > <cfdump var="#filteredArt#"> > > > > couple of suggestions: > > > > 1) if something isn't working, explain what's not working about it :) > > 2) <cfset threeMonthsAgo = dateAdd('m', -3, now()) /> <-- no need for > > dateFormat() there. only format a date if you're displaying it. > > 3) i don't believe there's any benefit to using cfqueryparam in a > > query of queries. it's not like there's the possibility of SQL > > injection, nor do i think there'd be any inherent performance benefits. > > > > > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:301003 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4