Every time you loop through the query, you reset your total variable. 
You may need two -- one for this loop, and one for the complete total.

--Ben Doom

Dr. Who wrote:
> i am having a problem trying to get the results of a count in a loop.
> could use another set of eyes..
> 
> results
> 
> VTodd :: 962
> STetreault :: 342
> RDoe :: 839
> ASchmit :: 379
> 
> TotalLeads 379 758 1137 1516
> 1516
> 
> it loops through the last result 4 times
> should result in: 2522 not 1516
> 
> code...
> 
> <cfoutput query="get_Sales" group="Market">
>   <h3><cfif get_Sales.Market IS 1>
>       Industrial Sales Reps
>       <cfelse>
>       IT Sales Reps
>     </cfif></h3>
>   <cfoutput group="Manager">
>     <h4>#get_Sales.Manager#</h4>
>     <h5>Name - Total Leads - Rep Company</h5>
>   <cfoutput>
>       <cfquery datasource="#request.dsn#" name="get_leads">
>         Select Count(*) AS total
>         From Leads
>         WHERE r_agn = #get_Sales.usr_id#
>       </cfquery>
> #get_Sales.Fname# #get_Sales.usr_lname# :: #get_leads.total#<br>
>       <br>
>     </cfoutput>TotalLeads<br>
>     <cfset sumTotal = 0>
>     <cfloop query="get_leads">
>       <cfoutput>
>         <CFSET sumTotal = #sumTotal# + #get_leads.total#>
> #sumTotal#</cfoutput>
>     </cfloop>
>     <br>
>     <span class="style1">#sumTotal#</span></cfoutput></cfoutput>
> 
> 
> 

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

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:295874
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