I am trying to select the IDs based on period and type of account.Each account type would have a different period. I tried the following code but it didnt like the < operator or any other operators. I cannot use a temp table due to system limitation. There are at least 6 types of accounts. I searched for different solutions but I didnt find anything . Any help is appreciated. Thank you
DECLARE @Inputperiod as INT
DECLARE @Start as INT
DECLARE @Enddate as INT
SET @Inputperdiod ='2009';
SET @Start=@Inputperiod-1;
SET @Enddate=@Inputperiod +1;
SELECT ID, Period, Type
FROM
TABLE1
WHERE
Period= CASE
WHEN Type='ASSET' THEN Period < @inputperiod
WHEN Type='Liability' THEN Period BETWEEN @start AND @enddate
END