Re: What is the best way to do this query?
Posted by:
Rick James
Date: August 14, 2016 06:38PM
JOIN explodes the number of rows, only to have GROUP BY or DISTINCT shrink the count. With the following code, you avoid this wasted effort:
select p.*
FROM product p
WHERE EXISTS(
SELECT *
FROM category_product c ON p.id_product=c.id_product
WHERE c.id_category IN (3,5,7,8)
);
Subject
Written By
Posted
Re: What is the best way to do this query?
August 14, 2016 06:38PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.