Try using the month, day and year instead.  Assuming MS SQL server:

WHERE Year(orderdate) = Year(GetDate()) AND Month(orderdate) =
Month(GetDate()) AND Day(orderdate) = Day(GetDate())

That will pull everything from the database where the month, day, and year
match the current monthm day and year.



On 8/21/06, Will Tomlinson <[EMAIL PROTECTED]> wrote:
>
> 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:250525
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to