title: How can I get a purchase check in MySQL
body: <p>I am not able to figure out how I can get the following result with one MySQL Query:</p>
  
  <p>I have two tables:</p>
  
  <p><strong>shop_items</strong></p>
  
  <pre><code>| id | description | price | active |
  +----+-------------+-------+--------+
  |  1 | product_1   |   5   |   1    |
  +----+-------------+-------+--------+
  |  2 | product_2   |  10   |   1    |
  +----+-------------+-------+--------+
  |  3 | product_3   |  15   |   0    |
  +----+-------------+-------+--------+
  </code></pre>
  
  <p><strong>inventory_items</strong> (the shop_items a user purchased)</p>
  
  <pre><code>| id | item_id | user_id | active |
  +----+---------+---------+--------+
  |  1 |    2    |    1    |   1    |
  +----+---------+---------+--------+
  |  2 |    1    |    1    |   0    |
  +----+---------+---------+--------+
  </code></pre>
  
  <p>I want to see all <code>shop_items</code> where <code>active = 1</code> including a row called <code>purchased</code> = <code>0 or 1</code> based on <code>inventory_items</code> -> matching <code>user_id</code> (where user_id = something) and <code>active = 1</code></p>
  
  <p><strong>Example output based on the data from above tables</strong> ->  <code>where user_id = 1</code>:</p>
  
  <pre><code>| item_id | price | description | purchased |
  +---------+-------+-------------+-----------+
  |    1    |   5   |  product_1  |     0     |
  +---------+-------+-------------+-----------+
  |    2    |  10   |  product_2  |     1     |
  +---------+-------+-------------+-----------+
  </code></pre>
  
  <p>What query do I need for this output?</p>
  
  <p>Please note: I only need the result from ONE user_id which I can change within the query :)</p>