title: SQL Select the similar products
body: <p>I have the following DB structure: (MySQL)</p>
  
  <pre><code>product(id,name)
  category(id,name)
  category_manager(id,fk_product,fk_category)
  </code></pre>
  
  <p>I want to select the similar products when I have a product. Selection should be done based on each product's categories. I want probably something like WP similar posts, but I don't know how to write it down.</p>
  
  <p>Let me give you an example.
  E.g.</p>
  
  <p>I have 3 products with the following:</p>
  
  <pre><code>product(id,name)
  product(1,towel)
  product(2,coat)
  product(3,tshirt)
  product(4,shoes)
  ....
  
  category(id,name)
  category(1,wool)
  category(2,cotton)
  category(3,windproof)
  category(3,synthetic)
  category(4,lether)
  ....
  
  category_manager(id,fk_product,fk_category)
  category_manager(1,1,1)
  category_manager(2,1,2)
  category_manager(3,2,2)
  category_manager(4,2,3)
  category_manager(5,3,1)
  category_manager(6,4,4)
  ....
  </code></pre>
  
  <p>If I have the towel's id how can I select the following products : </p>
  
  <p>"<code>3,tshirt</code>" (because it is in category "<code>1,wool</code>")</p>
  
  <p>"<code>2,coat</code>" (because it is in category "<code>2,cotton</code>")</p>
  
  <p>??????</p>
  
  <p>It's probably a join statement but...</p>