title: How to write SQL to return count of occurrences of join data?
body: <p>I have a table of houses and a join table of windows. So a house can have 0 or more windows, up to no limit (this is a contrived example, but it models what I'm working on).</p>
  
  <p>I want to be able to write an SQL query that returns the counts of houses that have 0 windows, the counts that have 1 window, the counts that have 2 windows, etc.</p>
  
  <p>I.e.:</p>
  
  <pre><code># Windows | # Houses
  --------------------
  0         | 27
  1         | 18
  2         | 45
  3         | 7
  etc.
  </code></pre>
  
  <p>The tables are super simple.  Window has a "house_id" foreign key which references the House table's ID field.</p>
  
  <p>I know this should be easy but for the life of me I can't figure it out?</p>
  
  <p>Thanks,</p>
  
  <p>Dan</p>