title: mysql query on many to many outer joins produce duplicates
body: <p>A query outer join problem.
  I have these three tables:<br/>
  Table article(
  id,
  articletitle, articletext) 
   - and so on. The other columns do not matter here.<br/>
  Table category(
  id,
  name)<br/>
  Table articlecategory(
  articleid,
  categoryid,
  index articleid, categoryid)<br/>
  When I execute the following query I get duplicates for any article that has more than one category
  Query:</p>
  
  <pre><code>SELECT category.name AS categoryname
       , article.id as articleid, article.articletitle  AS articletitle, article.articletext as articletext, article.articlev as articlev, article.visible as visible
       , GROUP_CONCAT(othercategory.name) AS othercategories
    FROM category
  LEFT OUTER
    JOIN articlecategory
      ON articlecategory.categoryid = category.id
  LEFT OUTER
    JOIN article
      ON article.id = articlecategory.articleid
  LEFT OUTER
    JOIN articlecategory AS otherarticlecategory
      ON otherarticlecategory.articleid = articlecategory.articleid
  LEFT OUTER
    JOIN category AS othercategory
      ON othercategory.id = otherarticlecategory.categoryid
  
  GROUP
      BY category.name ASC
       , article.articletitle  ASC';
  </code></pre>
  
  <p>The results are something like this:</p>
  
  <pre><code>foreach
  article 1
  othercategory = category(s) finishing, sanding
  article 1
  category(s) finishing, sanding
  article2
  category(s) tips
  article 3
  category(s) tips, informational
  article 3
  category(s) tips, informational
  endforeach
  </code></pre>
  
  <p>I did not write this query. The person who did I guess has gotten too busy to respond back. So I need some help but I am not smart enough for hints. So please be specific. I think I know what the problem is but I do not have enough experience to fix it.</p>