je tento dotaz to, co hledáte?
$query =<<<MYSQL
SELECT `prod_id`
FROM `produdct_category`
INNER JOIN `category` ON `product_category`.`cat_id` = `category`.`id`
WHERE `category`.`parent_id` = {$selectedParentId}
MYSQL;
Aktualizovaná otázka, aktualizovaná odpověď:
$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;