use a subquery..

select sum(foo) as daSum
from
(
  select count(goo) as foo
  from table
  where hoo = 1
)



On Jan 1, 2008 12:14 PM, Paul Ihrig <[EMAIL PROTECTED]> wrote:
> yeah
> i was trying to sum on the result of the count
> if i do this i only get the last result, not the sum of all
>
> <cfquery datasource="myBD" name="get_totals">
>    Select Count(*) AS total
>    From employees
>    WHERE emp_assigned = #get_Emp.usr_id#
> </cfquery>
>
> <cfquery dbtype="query" name="get_Sumtotals">
>    Select SUM(total) AS Sumtotal
>    From employees
> </cfquery>
>
> name value
> p1     25
> p2     30
> p3     10
>
> totalvalue 10
> should be 65
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:295648
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