use query.sumtotal On Jan 1, 2008 1:16 PM, morchella <[EMAIL PROTECTED]> wrote: > ok.. > i did this > > <cfquery datasource="myBD" name="get_totals"> > Select SUM(total) AS Sumtotal > From ( > Select Count(*) AS total > From employees > WHERE emp_assigned = #get_Emp.usr_id# > ) AS derived_table > </cfquery> > > but now i cant call the variable total to show with in my page? > it shows Sumtotal just fine.. > > i have tried > get_totals.derived_table.total > get_totals.total > derived_table.total > > > On Jan 1, 2008 1:32 PM, Greg Morphis <[EMAIL PROTECTED]> wrote: > > > > 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:295655 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

