title: Count one-to-many using left join gives wrong count on source table
body: <p>I have two tables <code>user_results</code> and <code>user_shares</code></p>
  
  <p><code>user_results</code> has:</p>
  
  <pre><code>id - pk
  platform - string
  country - string
  created_at - timestamp
  </code></pre>
  
  <p><code>user_shares</code> has:</p>
  
  <pre><code>id - pk
  user_result_id - integer
  created_at - timestamp
  </code></pre>
  
  <p>This is my query:</p>
  
  <pre><code>select 
      count(user_results.id) as results,
      count(user_shares.id) as shares,
      user_results.platform as platform 
  from
      user_results
  left join 
      user_shares on user_results.id = user_shares.user_result_id 
  group by 
      platform
  </code></pre>
  
  <p>Here's a sql fiddle with the schema and problematic query:
  <a href="http://sqlfiddle.com/#!9/739a3/2" rel="nofollow">http://sqlfiddle.com/#!9/739a3/2</a></p>
  
  <p>Now, as you can see on the fiddle I have only 1 result per platform but the <code>results</code> count shows (i guess) the "results count without share + shares count"</p>
  
  <p>What do I do wrong?</p>