title: SQL query returns same value in each column
body: <p>I'm having an issue with SQL joins in a query that is designed to query the Post table having been joined to the comment, click and vote table and return stats about each posts activity. My query below is what I've been using.</p>
  
  <pre><code>SELECT
      p.PostID, 
      p.Title, 
      CASE 
          WHEN COUNT(cm.CommentID) IS NULL THEN 0
          ELSE COUNT(cm.CommentID)
      END AS CommentCount, 
      CASE
          WHEN COUNT(cl.ClickID) IS NULL THEN 0 
          ELSE COUNT(cl.ClickID)
      END AS ClickCount, 
      CASE
          WHEN SUM(vt.Value) IS NULL THEN 0
          ELSE SUM(vt.Value)
      END AS VoteScore
  FROM 
      Post p
      LEFT OUTER JOIN Comment cm ON p.PostID = cm.PostID
      LEFT OUTER JOIN Click cl ON p.PostID = cl.PostID
      LEFT OUTER JOIN Vote vt ON p.PostID = vt.PostID
  GROUP BY
      p.PostID, 
      p.Title
  </code></pre>
  
  <p>Yields the following result</p>
  
  <pre><code>| PostID | CommentCount | ClickCount | VoteScore |
  |--------|--------------|------------|-----------|
  | 41     |            60|          60|         60|
  | 50     |          1683|        1683|       1683|
  </code></pre>
  
  <p>This, I know isn't correct. When comment out all but one of the joins:</p>
  
  <pre><code>SELECT
       p.PostID 
      ,p.Title 
      ,CASE 
          WHEN COUNT(cm.CommentID) IS NULL THEN 0
          ELSE COUNT(cm.CommentID)
       END AS CommentCount
  /*
      ,CASE
          WHEN COUNT(cl.ClickID) IS NULL THEN 0 
          ELSE COUNT(cl.ClickID)
       END AS ClickCount
      ,CASE
          WHEN SUM(vt.Value) IS NULL THEN 0
          ELSE SUM(vt.Value)
       END AS VoteScore
   */
  FROM 
      Post p
      LEFT OUTER JOIN Comment cm ON p.PostID = cm.PostID
  /*
      LEFT OUTER JOIN Click cl ON p.PostID = cl.PostID
      LEFT OUTER JOIN Vote vt ON p.PostID = vt.PostID
   */
  GROUP BY
      p.PostID, 
      p.Title
  </code></pre>
  
  <p>I get</p>
  
  <pre><code>| PostID | CommentCount |
  |--------|--------------|
  | 41     |             3|
  </code></pre>
  
  <p>Which is correct.  Any ideas what I've done wrong?</p>
  
  <p>Thanks.</p>