SQL equivalent of IN operator that acts as AND instead of OR?
问题 Rather than describe, I'll simply show what I'm trying to do. 3 tables in 3NF. product_badges is the join table. (The exists sub-query is necessary.) SELECT * FROM shop_products WHERE EXISTS ( // this line cannot change SELECT * FROM product_badges as pb WHERE pb.product_id=shop_products.id AND pb.badge_id IN (1,2,3,4) ); Now this will return all the products that have a badge_id of 1 OR 2 OR 3 OR 4. What I want is to get only the products that meet ALL those values . I tried to do pb.badge