I am facing one problem for creating one sql query. Actually i want to check if wherein clause Exists all elements or not, If all elements exists in WhereIn clause then i want to return that records with groupby.. Here is my one table produt_categories :-
id product_id category_id
1 1 1
2 1 2
Sow when i apply Wherein Like below:-
SELECT * FROM `product_categories`
WHERE category_id in (1,2,3) group by(product_id);
Now it return me this result:-
id product_id category_id
1 1 1
Actually its returning me fine because actual behavior of whereIn clause. So i want if all category_id 1,2,3 exists then it must show records. If i pass 1,2 then i will also come. Hope you guys understand.Please help me to create qyuery