(dynamic query…)
select * from myTable where
( <---
@param1 IS NULL
OR (
param1 IN
(
SELECT item
FROM blabla1
)
)
) <---
and
( <---
@param2 IS NULL
OR (
param2 IN
(
SELECT item
FROM blabla2
)
)
) <---
question :
look at the parenthesis marked with <---.
Can I remove them ( without impacting the logic here ) ?
No. you need those but you can remove the ones around the
INstatement.If you remove the ones you asked about you would have a query that works like this