title: Mysql Group_Concat function
body: <p>Not understanding how to use the GROUP_CONCAT function as my queries seem to repeat values that I don't actually want.  </p>
  
  <p>I have three tables:</p>
  
  <pre><code>------------------
  Content
  ------------------
  cid | title
  2334 | Lorem Ipsum
  
  ------------------
  Organizers
  ------------------
  cid | name | sort
  2334 | John Doe | 0
  
  ------------------
  Participants
  ------------------
  cid | name | sort
  2334 | Jane Doe | 0
  2334 | Bob Hope | 1
  2334 | Bart Simpson | 2
  </code></pre>
  
  <p>I'm trying to write a query that will produce:</p>
  
  <pre><code>cid | title | organizers | participants
  2334 | Lorem Ipsum | John Doe | Jane Doe, Bob Hope, Bart Simpson
  </code></pre>
  
  <p>So, I'm trying to use GROUP_CONCAT.  But, values are being repeated, so I'm not sure how to output the results I'm looking for?  </p>
  
  <pre><code>SELECT GROUP_CONCAT(co.name) as organizers, 
  GROUP_CONCAT(cp.name) FROM content n 
  LEFT JOIN organizers co ON n.cid = co.cid 
  LEFT JOIN participants cp ON n.cid = cp.cid 
  WHERE n.cid = 2334
  </code></pre>
  
  <p>The above yields:</p>
  
  <pre><code>cid | title | organizers | participants
  2334 | Lorem Ipsum | John Doe, John Doe, John Doe | Jane Doe, Bob Hope, Bart Simpson
  </code></pre>