title: Calculating a daily average (or: how many Mondays are in a date range?)
body: <p>My MySQL table has the following columns: datetime, price_paid.
  I'm trying to calculate the average sales per day of the week, between 2 dates. 
  This means I need select the sum of sales, between the dates startDate and endDate, grouped by weekday and divide that by the number of times every weekday occurs in that range.</p>
  
  <p>I got the first part:</p>
  
  <pre><code>SELECT DATE_FORMAT(datetime, '%a') AS field1, 
  round(SUM(price_paid)/ THEVALUEIMLOOKINGFOR ) AS field2 
  FROM Bills 
  WHERE date(datetime) BETWEEN '2012-01-02' AND '2012-01-09' 
  GROUP BY weekday(datetime)
  </code></pre>
  
  <p>What I don't have is that missing value: the number I should divide by - number of times each day appeared in that range. I tried several solutions, to no avail. </p>
  
  <p>Can someone please help me complete my SQL statement?</p>
  
  <p>Thanks for your time!</p>