title: How to count ID in child table?
body: <p>I want to count <code>StandardID</code> in two detail tables (<code>StandardCourses</code> and <code>StandardPosts</code>).<br>
  I wrote this code</p>
  
  <pre><code>Select es.StandardID, count(esc.StandardCourseID) as CourseIDCount,
         count(esp.StandardPostID) as PostIDCount
   from EduStandards as es 
        left join EduStandardCourses as esc on es.StandardID = esc.StandardID
        left join EduStandardPosts as esp on es.StandardID = esp.StandardID
   group by es.StandardID
  </code></pre>
  
  <p>but it return false result:</p>
  
  <pre><code>StandardID | CourseID | PostID
  -----------+----------+--------
       3     |     2    |    2
       4     |     1    |    1 
       5     |     1    |    0
       9     |     1    |    0
  </code></pre>
  
  <p>While it must return: </p>
  
  <pre><code>StandardID | CourseID | PostID
  -----------+----------+--------
       3     |     1    |    2
       4     |     1    |    1
       5     |     1    |    0
       9     |     1    |    0
  </code></pre>