Implementing Group By and Sum

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

<% @activities.each do |c| %> <% end %>
Employee Minutes
<%=h c.employee.first_name %> <%=h c.employee.last_name %> <%=h c.period %>

How to include sum(period)?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs