title: MySQL: Join 3 tables and filter by one of them
body: <p>I have three tables with the following columns:</p>
  
  <pre><code>blog:  
  id | title | body
  
  categories:
  id | title
  
  blog_categories_join: 
  blog_id | category_id
  </code></pre>
  
  <p>I'm using this MySQL query to get the first 8 blog posts and join each post's respective categories:</p>
  
  <pre><code>SELECT b.* 
  GROUP_CONCAT(c.title ORDER BY c.id ASC SEPARATOR ', ') AS categories,
  FROM blog b
  LEFT OUTER JOIN blog_categories_join bcj ON bcj.blog_id = b.id
  LEFT OUTER JOIN categories c ON c.id = bcj.category_id
  GROUP BY b.title
  ORDER BY b.date DESC LIMIT 8
  </code></pre>
  
  <p>This is working great for me. However, I'd like to get the first 8 blog posts of a specific category as well. So I've tried adding a WHERE clause:</p>
  
  <pre><code>SELECT b.* 
  GROUP_CONCAT(c.title ORDER BY c.id ASC SEPARATOR ', ') AS categories,
  FROM blog b
  LEFT OUTER JOIN blog_categories_join bcj ON bcj.blog_id = b.id
  LEFT OUTER JOIN categories c ON c.id = bcj.category_id
  WHERE bcj.category_id = $id 
  GROUP BY b.title
  ORDER BY b.date DESC LIMIT 8
  </code></pre>
  
  <p>This works in the sense that it only pulls the blogs from the specified categories, but my GROUP_CONCAT no longer contains every category the blog belongs to. It only contains the category specified in the WHERE clause. </p>
  
  <p>Is it possible for me to query only posts that belong to a specified category and also return it's respective categories with the way my table structure?</p>