title: Summarizing records by date in Rails 3 ActiveRecord
body: <p>I have a large table with many records that share a timestamp. I want to get a result set that has a column summed by timestamp. I see how you can simply use the 'sum' method to get a columns total. I need to, however, group by a date column. This is far less obvious. I know I can use 'find_by_sql' but it will be hideous to code as I have to do this for over 20 columns. I assume AR must have some magic to do this which escapes me?</p>
  
  <p>Date set example:</p>
  
  <p>table/model: games/Game</p>
  
  <pre><code>player_name, points_scored, game_date
  john, 20, 08-20-2012
  sue, 30, 08-20-2012
  john, 12, 08-21-2012
  sue, 10, 08-21-2012
  </code></pre>
  
  <p>What i want to see in my results is:</p>
  
  <pre><code>game_date, total_points
  08-20-2012, 50
  08-21-2012, 22
  </code></pre>
  
  <p>Here is a crude example of what the SQL query would look like:</p>
  
  <pre><code>SELECT game_date, SUM(points_scored)
  FROM games
  GROUP BY game_date
  </code></pre>
  
  <p>Mind you, I actually have 20 'score' columns to SUM by timestamp.</p>
  
  <p>How can I simply use AR to do this? Thanks in advance.</p>