title: How to count rows on joined table
body: <p>I have 2 tables --  a master (called groups) and details (called users)</p>
  
  <p>I want to return each and every master row for subsequent display, but I only want to count how many detail rows match the master</p>
  
  <p>My query is not working properly -- it only returns the first row in the master table</p>
  
  <pre><code>$query_string = '
      SELECT groups.userGroupID, userGroup,
             count(users.userGroupID) AS howMany
      FROM groups_table AS groups
      JOIN users_table AS users ON users.userGroupID = groups.userGroupID
      ORDER BY groups.userGroupID
  ';
  </code></pre>
  
  <p>Thanks for helping.</p>