title: calculate percentage with subqueries
body: <p>I'm trying to calculate a percentage in my SQL query.</p>
  
  <p>This is what I have right now:</p>
  
  <pre><code>SELECT
  DATE(processed_at) AS day,
  (
    SELECT
    COUNT(*) FROM return_items
    WHERE return_id IN (SELECT id FROM returns WHERE DATE(processed_at) = day)
  ) as products_returned,
  COUNT(*) as return_count,
  (
    SELECT
    COUNT(*) as co_returns
    FROM returns
    WHERE return_method = 'mondial_relais'
    AND DATE(processed_at) = day
  ) as return_rate_mr
  FROM returns
  WHERE MONTH(processed_at) = 10
  AND YEAR(processed_at) = 2011
  GROUP BY day;
  </code></pre>
  
  <p>Basically I need the return_rate_mr to be a percentage value.
  I tried doing something like <code>return_rate_mr * 100 / return_count as perc_value</code> but this  doesn't work. (I don't actually need the current <code>return_rate_mr</code> value, just the percentage.</p>
  
  <p>Any ideas? </p>