title: SQL Query for Summary By Instances Per Day
body: <p>I've got a table in a mysql database that contains monetary transactions.  Let's say the tabled is called <em>transactions</em>:</p>
  
  <pre><code>id int,
  to_user int,
  from_user int,
  created datetime,
  amount double
  </code></pre>
  
  <p>I'm trying to create a query that returns the average amount of a transaction grouped by the number of transactions that appear per day.  The applicable columns are amount and created.</p>
  
  <p>So I'm trying to answer the question: what is the average amount of transactions that occur on days where there are between 0 and 2 transactions, between 2 and 4 transactions, between 4 and 6 transactions, etc.</p>
  
  <p>Any ideas?</p>