title: MySQL query joining issue
body: <p>I have three tables</p>
  
  <pre><code>--Categories--
  id, Name
  
  -- Products --
  id, name, price
  
  -- productCategories --
  id, product_id, category_id
  </code></pre>
  
  <p>i want to get similar products. </p>
  
  <p>for instance. to get similar products by name i wrote</p>
  
  <pre><code>SELECT * FROM products 
              where products.name in (select products.name from products
              join productcategories on products.id=productcategories.product_id
              group by products.name having count(*)&gt;1)
  </code></pre>
  
  <p>But i can't get products that are similar by cateogory.
  i wrote something like this, but it's wrong</p>
  
  <pre><code> SELECT * FROM products 
                  where 
  products.name in(select products.name from products join productcategories
                                  on products.id=productcategories.product_id
                                  join Categories on productcategories.category_id =Categories.id)
  </code></pre>
  
  <p>can u help me, please?</p>