I'm trying to optimise some queries, but I have multi-select parameters within the query, for example:
WHERE BusinessUnit IN (@BusinessUnit)
Now, I thought that the way to SELECT multiple values into a variable was done like this:
DECLARE @BusinessUnit AS int; SELECT @BusinessUnit = BU.ID FROM LookupTables BU WHERE BU.AttributeName = 'BusinessUnit'
...but when I run this...
...I only get a single result. Not sure what the solution is, as I'm having trouble finding a resource via my Google searches
EDIT: Yes, there are definitely multiple results for AttributeName = 'BusinessUnit' in LookupTables
This post has been edited by e_i_pi: 07 March 2012 - 07:22 PM