I have a table of data, and would like to create a case when based on the following parameter:
DECLARE @FY_Ending INT
SET @FY_Ending = 2020
If @FY_Ending
is < to 2020 then take the column named Code
If @FY_Ending
is >= 2020 then take the column name Code but drop where LA_Code in (810,811)
(Note: Code is just a column of different numbers and 2 would like to be excluded from 2020 onwards)
How would I go about writing this?
Thank you in advance
The sql should look like this
select Code from Table where (@FY_Ending < 2020) or (@FY_Ending >= 2020 and LA_Code in (810,811)