I want to perfom the sql query,
SELECT employee_id, sum(period) FROM activity_charts group by
employee_id
So far, I was able to do SELECT employee_id, period FROM
activity_charts group by employee_id
My report_controller.rb is
class ReportController < ApplicationController
def index
@activities = ActivityChart.find(:all, :select =>
‘employee_id,period’, :group => “employee_id”)
end
end
and the index.html.erb is
Total Hours Worked
Employee | Minutes |
---|---|
<%=h c.employee.first_name %> <%=h c.employee.last_name %> | <%=h c.period %> |
How to include sum(period)?