troubleshooting Question

MySql AND / OR selection whilst using IN

Avatar of Lmillard
Lmillard asked on
MySQL ServerSQL
2 Comments1 Solution400 ViewsLast Modified:
Hi,

I am using IN with a query of mine to select products based on variant filters and I have noticed that it selects very much like the OR operator. is there a way to make this work the same as AND?

Query is very much like the attached code

Regards
Leigh
SELECT 
        DISTINCT(prodCode),
        RosettePadding,
        RosetteText,
        TitleDesc 
        FROM products 
        WHERE filterOptionID IN(1,20,25,13,19)
        ORDER BY TitleDesc, SortOrd, ProdCode
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros