All,
I am trying to execute the following SQL code and have the result
returned to my application for further proessing…
“select SUM(action) as ‘sum’ from approvals where upload_id = ?”,
@upload.id
I have tried this in a Approval.find_by_sql also as a
Approval.connection.execute, but I can’t seem to get the data back
into rails… How can I access the returned data, which should be a
single number? I tried @points.sum, @points, etc. I want to do some
numerical comparisons on this, so I need the number, and just the
number.
Oh, and action
can be any number from -3 to 3, so I can’t just do a
count…
Any ideas?
Thanks!