I'm trying to write a statement with a conditional where clause. The issue is due to needing to return multiple criteria using IN. Currently I'm returning the error:
Incorrect syntax near the keyword 'IN'.
/****** Script for SelectTopNRows command from SSMS ******/
DECLARE @paramTime VARCHAR(50);
DECLARE @paramView VARCHAR(50);
SET @paramTime = '2020M2';
SET @paramView = 'YTD';
SELECT *
FROM [dbo].[vBiB_AllAccounts]
WHERE
[sTime] =
CASE
WHEN @paramView = 'YTD' AND @paramTime = '2020M1' THEN
'2020M1'
WHEN @paramView = 'YTD' AND @paramTime = '2020M1' THEN
In('2020M1','2020M2')
END