title: Selecting row count from associated table without subselect
body: <p>I'm trying to write a SQL query that returns a single row for each user. That row must contain a count of the schools assigned to that user and a sum of the points across all schools assigned to that user.</p>
  
  <p>Tables:</p>
  
  <pre><code>users (id, email)
  schools (id, user_id, points (int))
  </code></pre>
  
  <p>Relation <code>users</code> to <code>schools</code> is one-to-many.</p>
  
  <p>I've gotten this far:</p>
  
  <pre><code>select u.id, u.email, 
    count(*) as total_schools, 
    sum(points) as total_points
  from users u
  left join schools s 
    on u.id = s.user_id 
  group by u.id
  </code></pre>
  
  <p>But this doesn't quite work. The <code>count(*) as total_school</code> is wrong. It returns the number of user rows, not the number of assigned school rows.</p>
  
  <p>How do I get that count?</p>