title: MySQL Group By Does Not List All The Group Items
body: <p>We have tables Teach(cid,pid) and Professor(pid,name) and I want to find all the courses that professor Benjamin taught. Note that there might be more than one professor called Benjamin. So I wrote this query:</p>
  
  <pre><code>SELECT T10.cid,T10.pid
  FROM Teach T10
  WHERE T10.pid IN (SELECT P10.pid FROM Professor P10 WHERE P10.name='Benjamin')
  GROUP BY T10.pid  
  </code></pre>
  
  <p>But this query just gives 1 course for each pid whose name is Benjamin although there are more courses related to these pids in the tables.</p>
  
  <p>What is the problem?Please help.</p>