このクエリはあなたが探しているものですか?
$query =<<<MYSQL
SELECT `prod_id`
FROM `produdct_category`
INNER JOIN `category` ON `product_category`.`cat_id` = `category`.`id`
WHERE `category`.`parent_id` = {$selectedParentId}
MYSQL;
更新された質問、更新された回答:
$query =<<<MYSQL
SELECT *
FROM `produdcts`
INNER JOIN `produdct_category` ON `products`.`prod_id` = `produdct_category`.`prod_id`
INNER JOIN `category` ON `product_category`.`cat_id` = `category`.`id`
WHERE `category`.`id` = {$selectedCatId}
OR `category`.`parent_id` = {$selectedCatId}
MYSQL;