Hi John, I would probably recommend you use SQL like:
*********************************************
SELECT DateDiff(d,Date1,Date2) AS sumDiff
FROM Table
*********************************************

Regards,
Misha

-----Original Message-----
From: John Ahlen [mailto:[email protected]] 
Sent: Saturday, January 03, 2009 9:37 PM
To: cf-newbie
Subject: DateDiff Question

Hello All,

I took a shot in the dark and tried to run the query of query below, but
with no success.

<cfquery name="sumDateDiff" dbtype="query">
        SELECT vendorPk,vendorName,SUM(#DateDiff("d",DateCreated,DateRecd)#)
AS sumDiff
        FROM qGetOrders
        WHERE invAmt <> 0
        GROUP BY vendorPk,vendorName
        ORDER BY vendorPk
</cfquery>              

What I'm trying to do is get a sum of the difference in days between two
dates from a query.  This sum will be averaged by the number of orders by
the respective vendors.

Any suggestions?

Thanks in advance,

John 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:4258
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15

Reply via email to