>Use a parameter (tinyint) in your query that will show you what you want, That parameter will accept 3 values:
>0 - Inactive
>1 - Active
>2- all
>Then build your where clause that way:
>WHERE (@Parameter = 2 OR IsActive = @Parameter)
Thanks, Borislav. This idea would not work for our particular scenario, but thanks.
My question was more of does it matter in SQL where the condition is placed.
In other words, having IsActive condition in each union is theoretically supposed to be better than having it as the last clause
e.g. which SQL should perform better
select * from (firstPart where IsActive UNION secondPart where IsActive etc.)
versa
select * from (fristPart union ....) where IsActive
If it's not broken, fix it until it is.
My Blog