Is it posible to use case in where in clause? Something like this:
DECLARE @Status VARCHAR(50);
SET @Status=\'published\';
SELECT * FRO
I believe you can use a case statement in a where clause, here is how I do it:
Select
ProductID
OrderNo,
OrderType,
OrderLineNo
From Order_Detail
Where ProductID in (
Select Case when (@Varibale1 != '')
then (Select ProductID from Product P Where .......)
Else (Select ProductID from Product)
End as ProductID
)
This method has worked for me time and again. try it!