Is there a way to do something like this? (This is pseudo code)
CASE(@P1)
WHEN 'a' or 'd' or 'z' THEN 1
WHEN 'b' or 't' THEN 2
ELSE 0
The idea being that I can check multiple values that should return the same value. i.e. 'a' returns 1 and 't' returns 2
select CASE WHEN @P1 in ('a', 'd', 'z') THEN 1
WHEN @P1 in ('b', 't') THEN 2
ELSE 0
END
from your_table
or
select CASE WHEN @P1 = 'a' or @P1 = 'd' or @P1 = 'z' THEN 1
WHEN @P1 = 'b' or @P1 = 't' THEN 2
ELSE 0
END
from your_table
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With