You could use a query of query (QoQ)

<cfquery name="qSum" dbtype="query">
select
  sum(quantity) as total_fruits
from
  fruits
</cfquery>

Other than that, there's looping ;)

Francois Levesque
http://blog.critical-web.com/


On Thu, Dec 18, 2008 at 1:46 PM, patrick buch <[email protected]>wrote:

> Hi,
>
> Now I know you can sum in the query to the db. I was wondering though, is
> there a way to sum on the results you get back from a query through CF? For
> instance:
>
> Results of query
> Fruit Quantity
> apple 3
> apple 2
> total: 5
>
> Something like:
>
> cfset qSum = sum(myquery.quantity)
>
> Total of fruit: #qSum#
>
> Thanks... Hope this makes sense.
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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-talk/message.cfm/messageid:316918
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