Categories

SELECT from table WHERE items IN (@variable)

You need to make query like "SELECT * from tbl WHERE items IN ('item1', 'item2', 'item3', 'item4')" and you want to send items to IN clause as variable. It’s nice when, for example, you want to execute Stored procedure or, as in example below, use INSERT ... SELECT construction. Then you need to make a fint with quotes.