While there is sometimes need to do aggregates in ColdFusion it also pays to learn how to get them using SQL.
This is especially important if datasets grow beyond 1000 lines and you only need aggregate information. Bringing all data to ColdFusion and processing it there is extremely expensive compared to doing it in database and only returning data actually needed. One thing I'd like to point out as well is cfoutput "group" attribute. It can be used in variety of situations and could be definitely useful in this case (depending what Michele actually has to accomplish) Tero Pikala -----Original Message----- From: Deanna Schneider [mailto:[EMAIL PROTECTED] Sent: 09 February 2007 19:40 To: CF-Talk Subject: Re: Adding fields from a sql You'd probably have to be a bit more specific to get real solid answers. You can, for example, treat a query like an array and sum a column. <cfset mytotal = arraysum(myquery[mycolumn])> You can sum row data across columsn <cfset mytotal = myquery.mycolumn[1] + myquery.myothercolumn[1]> If you can give us more info about what you want to accomplish, we can probably help you out. You can loop through a query and sum things along the way, too. So, what are you really trying to do? On 2/9/07, Michele Michele <[EMAIL PROTECTED]> wrote: > Hi- > I am not a proficient CF programmer, just got pushed into it. I need to add up fields brought in from a sql statement, various totals from different columns, and output them along with the individual column totals. Is there any way at all I can do this? I bet this sounds amatuer and trust me it is. Please take pity on me if someone out there can tell me! > > Thanks, > Michele > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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:269900 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

