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 <h1>Total Hours Worked</h1> <table> <tr> <th width ="180px">Employee</th> <th width ="60px">Minutes</th> </tr> <% @activities.each do |c| %> <tr> <td><%=h c.employee.first_name %> <%=h c.employee.last_name %></td><td><%=h c.period %></td> </tr> <% end %> </table> How to include sum(period)? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---