I am trying to make a report and I have the problem in the @myTab parameter that I need multiple selections to be able to select several or all the elements and be able to know which country it belongs to, the problem occurs when I select more than one element, this is the query I'm overlooking
select [CompanyName],[ContactName],[Country] from [Customers]
where [Customers].ContactName in (@myTab) and [Customers].Country=@pais or
[Customers].Country=@pais and @myTab is null
CodePudding user response:
This is because of @myTab is null condition(we can't check multi-valued parameters directly with "is null"), Try removing this and validate again. One more thing is that, be sure about "and" and "Or" conditions - Use proper brackets to avoid data issues