title: How to sum a grouped column in AREL
body: <p>in Rails 3/AREL</p>
  
  <p><code>Model.group(:label).sum(:value)</code> will do</p>
  
  <pre><code>SELECT sum(value), label from model_table group by label
  </code></pre>
  
  <p>I am trying to find the AREL way of doing</p>
  
  <pre><code>SELECT sum(value) from (select value, label from model_table group by label)
  </code></pre>
  
  <p>which is <code>Model.group(:label).map(&amp;:value).sum</code> using ruby to sum, how do I do this in SQL/AREL</p>