title: How to determine the average number of notes per user?
body: <p>I have the following two tables in my MySQL database:</p>
  
  <pre><code>User (id, created_at, ...)
  Note (id, created_at, ...)
  </code></pre>
  
  <p>What I'm hoping to do with my DB is generate a report like so:</p>
  
  <pre><code>Users created X weeks ago | X of users | average number of notes
  1 | 20 | 2
  2 | 31 | 3
  3 |  5 | 4
  </code></pre>
  
  <p>Last row example... 3 weeks ago, 5 users were created in just that week range, and they on average have created a total of 4 notes.</p>
  
  <p>Where the users selected per row is based on that week range... and the average number of notes is for the user during any time frame...</p>
  
  <p>Can this be done with SQL or is this to complex and I'll need to build this into my Rails app?</p>
  
  <p>Thank you for the help.</p>