title: MySql Left join with find_in_set not working properly?
body: <p>I have written query using left join which joins 3 tables to get the data, they are:</p>
  
  <p>Products:</p>
  
  <pre><code>product_id  category_id  master_category_id  manufacturers_id  product_name  product_img  product_des  product_price  product_status
    17421      194           4,6,7,5               2504           prod_name    image-1.jpg   ----            ----              1
  </code></pre>
  
  <p>master_categories:</p>
  
  <pre><code> master_category_id  master_category_name  original_image  picture  small  thumb  icon_img  master_category_status
      1               Dinnerware/Glassware   cat-image1.jpg     --      --      --     --             1
  </code></pre>
  
  <p>manufacturers:</p>
  
  <pre><code>manufacturers_id   manufacturers_name  original_image  picture  small  thumb  manufacturers_status
    1                    CalMil           Cal-Mil.png      --      --      --    1
  </code></pre>
  
  <p>My Query is:</p>
  
  <pre><code>select (Case When p.product_status  = '0' Then 'Inactive' 
               When p.product_status  = '1' Then 'Active' 
               Else 'Deleted' End) AS status,
  m.manufacturers_name,
  GROUP_CONCAT(mc.master_category_name) as master_category_name,
  TRIM(p.product_name) as product_name,
  p.product_status,p.product_id 
  from products p 
  left join manufacturers m 
  on p.manufacturers_id=m.manufacturers_id 
  left join master_categories mc 
  on find_in_set(mc.master_category_id,p.master_category_id) 
  where p.product_name!=''
  GROUP BY p.product_name order by TRIM(p.product_name) ASC LIMIT 0,15
  </code></pre>
  
  <p>Each product has multiple master_categories which store their multiple master_category id's for 'master_category_id' column in 'products' table as shown in the 'products' table above. </p>
  
  <p><strong>My problem here is My query is returning a master_category_name even for product which doesn't have any 'master_category_id' i.e., product is showing a master_category_name even if it doesn't have any master_category_id assigned and also product which has only 2 master_categories showing more than 2 categories</strong>.</p>
  
  <p>Can anyone please help me What's wrong in my query. Thanks.</p>