title: count in sql - two tables
body: <p>I have two tables:
  teams(id, name) and users(id, name, team_id)</p>
  
  <p>I want a following result:</p>
  
  <pre><code>Team  | Members 
  team1 | 10 
  team2 | 14 
  team3 | 8
  </code></pre>
  
  <p>I tried:</p>
  
  <pre><code>SELECT t.name AS 'Team', COUNT(u.email) AS 'Members' FROM teams t INNER JOIN users u ON (u.team_id = t.id) 
  </code></pre>
  
  <p>but it wouldn't work.</p>