title: MySQL query: Join tables and display records as comma separated string in a single row
body: <p>Suppose I have the following two tables in my MySQL database:</p>
  
  <pre><code>Table 1:: EMP: EmpID, EmpName
  eg. (1, 'John'), (2,'Alex'),(3,'Tom')
  
  Table 2:: Team: TeamID, ManagerID, MemberID
  eg. record1: (Team1, 1, 2), record2: (Team1, 1, 3) 
  </code></pre>
  
  <p>so there is a team with id team1, John is the manager and Alex and Tom are its members.</p>
  
  <p>I want to display the records of the Team table on the screen in the following manner</p>
  
  <pre><code>| Team  | Manager | Members   |
  | team1 | John    | Alex, Tom |
  </code></pre>
  
  <p>What should be SQL query which will join the above two tables and return me the names of the members when based on the memberIDs. </p>
  
  <p>Also the result will be displayed as 1 row containing all the team members separated by a comma.</p>
  
  <p>If there is a better way of designing these two tables then please suggest that also. It will be much appreciated.</p>
  
  <p>Thanks.</p>