I am working on a query / stored procedure that for simplicity simply says "Select * from table
" Im about to change this to say select * from table where location=@location
.
However, in saying this I may have to pass in more than one location. I do not necessarily want to create 30 @location variables and say when location =@location1 and location=@location2
etc etc. So what I have elected to do is,
SELECT *
FROM
TABLE
WHERE
LOCATION
IN (SELECT location FROM locationtable)
HOWEVER, again, the "locationtable" houses everylocation. (say locationtable has location A,B&C) how would I edit this to say select * where location is A & B ( bearing in mind A&B is passed in as parameters)
I would like to know if there is a way I can accomplish something similar in my stored procedure to do what I jut said.
Thank you