Displaying 1 result from an estimated 1 matches for "sum_amounts".
2007 Jan 25
3
Sum multiple columns individually
Can you sum a few columns at a time?
I tried
x =Calc.find(:all, :select => "sum(amt1) amt1, sum(amt2) amt2"
:conditions => ["where date > ?", date] )
The sql seems to function properly, but I wasn''t able to grab the
values. These just failed
x.amt1
x.send("amt1")
I tried changing up the query to use
sum(amt1) as amt1
sum(amt1)