> From SQL Book On Line: > SELECT type, SUM(price), SUM(advance) > FROM titles > WHERE type LIKE '%cook'
>From this example we're missing the group by clause, required since "type" is not an aggregate. Add: GROUP BY type to that query. If you just need the sum of a column from a query, without a breakdown, you can do an arraysum on the query column from CF: #arraysum(listtoarray(valuelist(qry.col1)))# I thought I remembered a way to reference a specific column from a query as an array directly, but it escapes me now. Cheers, Kris > > I am trying to get the sum of an expenses column for all rows. I have > > no clue how to go about this. I played around with cfloop a little bit, > > but just ended up adding the current row's column to itself, then moving > > on to the next row and doing the same. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Upgrade to Adobe ColdFusion MX7 Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:267820 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

