Which conditional statement do I use?
Is there a way to convert the following "multi-condition" SELECT statement into a "single-condition" SELECT statement? I need it to be one condition so it can be used inside a Stored Procedure. The problem I am having is the number of "AND" conditions can change.
Code:
SELECT pcSearchFields_Products.idProduct
FROM pcSearchFields_Products
WHERE
pcSearchFields_Products.idSearchData = 3 AND
pcSearchFields_Products.idSearchData = 4
In place of the example "AND" conditions I tried to use one statement of "IN (3,4)". However, "IN" returns true if any one of the values match whereas I need them all to match.
Anyone have any ideas? I suspect this is simple for someone experienced with stored procedures.