1<?php
2 SELECT `mgt_products`.`id`,`mgt_products`.`pro_name`,`mgt_products`.`cate_id`,
3 `mgt_products`.`subcate_ids`,`mgt_subcategories`.subcat_id FROM `mgt_products`
4 JOIN `mgt_categories` ON `mgt_products`.`cate_id` = `mgt_categories`.`cat_id`
5 JOIN `mgt_subcategories` ON find_in_set(mgt_subcategories.subcat_id, mgt_products.`subcate_ids`)
6 WHERE `mgt_categories`.`cat_id` = 2
7 AND find_in_set(7, mgt_products.`subcate_ids`)
8 GROUP BY `mgt_products`.`id`
9
10?>