title: MySQL - How do I get SUM of a COUNT of a field?
body: <p>I'm using the following statement and getting almost everything I need. In addition, I'd like to get the SUM of all of the row_total results.</p>
  
  <pre><code>    SELECT c.id AS campaign_id, c.amount AS campaign_amount, c.warning_trigger,
  COUNT(cc.id) as code_count, DATEDIFF(c.end_date, CURDATE()) as days_remain,
  SUM(c.amount) as row_total
  FROM campaigns c
  JOIN campaign_codes cc
  LEFT JOIN partners p on p.id = 4
  WHERE c.partner_id = 4 AND cc.status = 0 AND c.id = cc.campaign_id
  GROUP BY c.id
  ORDER BY campaign_amount ASC
  </code></pre>
  
  <p>And here's an example result, with the last column being the column I want to add together:</p>
  
  <pre><code>    1 10.00 30 992 24 9920.00
      3 25.00 30 995 290 24875.00
      16 50.00 30 988 335 49400.00
      17 100.00 30 1000 335 100000.00
  </code></pre>