<?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`
?>