The problem here is that you are creating a datetime, which contains the
time and comparing with a date.

You need to use a greater than comparison.
 try this:

WHERE orderdate =
  <cfqueryparam cfsqltype="cf_sql_timestamp"
value="#CreateODBCDate(Now())#">

Kevin

-----Original Message-----
From: Will Tomlinson [mailto:[EMAIL PROTECTED]
Sent: 21 August 2006 22:50
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:250523
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