title: MySQL join with where clause
body: <p>I have two tables I want to join.</p>
  
  <p>I want all of the categories in the categories table and also all of the categories subscribed to by a user in the category_subscriptions table.</p>
  
  <p>essentially this is my query so far:</p>
  
  <pre><code>SELECT *
  FROM categories
  LEFT JOIN user_category_subscriptions 
       ON user_category_subscriptions.category_id = categories.category_id
  </code></pre>
  
  <p>This works fine however I want to add a where clause on the end of the query which then essentially makes it an inner/equi join.</p>
  
  <pre><code>   SELECT *
      FROM categories
      LEFT JOIN user_category_subscriptions 
           ON user_category_subscriptions.category_id = categories.category_id 
     WHERE user_category_subscriptions.user_id = 1
  </code></pre>
  
  <p>How do I get all the categories as well as all the categories subscribed to by a particular user using only one query?</p>
  
  <p>category_id being a key in both categories table and user_category_subscriptions. user_id residing in the  user_category_subscriptions table.</p>
  
  <p>thanks</p>