The problem you are seeing is that when you are comparing orderdate =
now() that it's including minutes and seconds, which will not equal your
record.  

You can use:
 WHERE CAST(CONVERT(varchar, orderdate, 1) as smalldatetime) =
'8/19/2006' to get all valid orders from the specific date regardless of
min and seconds.

HTH,

Rich Kroll


-----Original Message-----
From: Will Tomlinson [mailto:[EMAIL PROTECTED] 
Sent: Monday, August 21, 2006 4:50 PM
To: CF-Talk
Subject: Getting today's orders?

I need to get today's orders in a query. I know there's one test order
in
the db today, but I can't get my query to return anything. It's SQL
Server,
smalldatetime field. Here's the data in the db: 8/13/2006 6:04:00 PM

What do I do to make this work? 

<cffunction name="getTodayOrders" access="public" returntype="query"
output="false"
         hint="Returns a query of today's orders">
  <cfset var gettodayorders = "">
  <cfquery name="gettodayorders" datasource="#VARIABLES.dsn#">
  SELECT orderID, orderdate, ordersubtotal, ordertotal, cartID,
paymentstatusID,  paypalpaymenttypeID, shiptotal
  FROM tblOrders
  WHERE orderdate =
  <cfqueryparam cfsqltype="cf_sql_timestamp"
value="#CreateODBCDateTime(Now())#">
  ORDER BY orderdate DESC
  </cfquery>
  <cfreturn gettodayorders>
</cffunction>

Thanks,
Will





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:250527
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to