I'm trying to generate reports that has multiple search filters and I need those search filters to be able to take multiple values as search parameters.
Create Proc [procedure_name](
@name nvarchar(50) null,
@center nvarchar(3)null,
@branch nvarchar(6)null
)
As
Begin
Select [column1], [column2], [column3], [column4]
from table1 a
left join table2 b
on a.cid=b.cid and a.acc=b.acc
Where @name is null or a.Name=@name
and @center is null or a.center=@center
and @branch is null or a.branch=@branch
End
I need those search parameters to be able to take multiple values and filter them in the same table i.e. instead of @name = 'Mark' gives all result that has Mark I need @name = 'Mark', 'James', 'Adam' that give all results that has Mark, James and Adam.