what RDBMS are you using?  
Look at the BETWEEN op

WHERE DEPART_DATE BETWEEN #TodayDate# AND  #FutureDate#

Also, I'd use cfqueryparam on this
WHERE DEPART_DATE BETWEEN <cfqueryparam cfsqltype="cf_sql_date"
value="#TodayDate#" /> AND  <cfqueryparam cfsqltype="cf_sql_date"
value="#FutureDate#" />

Actually, I'd use the DB maybe for this too....on Oracle something like this

WHERE DEPART_DATE BETWEEN sysdate AND sysdate+ #form.departuredate#


Doug




On Thu, 28 Oct 2004 11:15:20 -0400, Les Mizzell <[EMAIL PROTECTED]> wrote:
> I don't know why I have so much trouble with this..
> 
> OK, I need to get all records with a depart date starting today and for
> the next 15 days...
> 
> So, first set the variables...
> 
> <cfset TodayDate = #CREATEODBCDATE(now())#>
> <cfset FutureDate = #CREATEODBCDATE(now() + form.departdate)#>
> <!--- form.departdate is a simple number showing number of days in the
> future - 15, 30, 45. --->
> 
> ...and then it seems this should work in the query:
> 
> WHERE DEPART_DATE >= #TodayDate# and DEPART_DATE <= #FutureDate#
> 
> But, it isn't working.
> 
> Problem 1: This database was handed to me to work with. It's mySQL.
> "DEPART_DATE" is a varText field and all the dates in it are listed as
> "8/15/2004". This is probably causing all my headaches.
> 
> Simply switching the data type in the database doesn't work - the data
> gets translated incorrectly.
> 
> So, advise on how to best correct this problem and get the query to work
> correctly?
> 
> I'm only an idiot half the time...
> 
> --
> Les Mizzell
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Purchase from House of Fusion, a Macromedia Authorized Affiliate and support the CF 
community.
http://www.houseoffusion.com/banners/view.cfm?bannerid=35

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:182819
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to