Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

join with 2 table where id match in table 1 comma separated

<?php 
 SELECT `mgt_products`.`id`,`mgt_products`.`pro_name`,`mgt_products`.`cate_id`,
	`mgt_products`.`subcate_ids`,`mgt_subcategories`.subcat_id FROM `mgt_products` 
	JOIN `mgt_categories` ON `mgt_products`.`cate_id` = `mgt_categories`.`cat_id`
	JOIN `mgt_subcategories` ON find_in_set(mgt_subcategories.subcat_id, mgt_products.`subcate_ids`)
    WHERE `mgt_categories`.`cat_id` = 2
    AND find_in_set(7, mgt_products.`subcate_ids`)
    GROUP BY `mgt_products`.`id`
      
?>      
 
PREVIOUS NEXT
Tagged: #join #table #id #match #table #comma #separated
ADD COMMENT
Topic
Name
7+3 =