Skip to content
Advertisement

SQL Select List mulitple values with case then

I have a variable and based on the variable I want to exclude the value from the select command. It works fine if I want to exclude 1 string, but if it’s not working if I’m excluding multiple string in same condition. Here’s the code. It works fine when variable is abc and EFG, but for XYZ I want to exclude both ‘abc’ and ‘efg’

I tried with ‘%abc%’ and ‘%efg%’ and ‘%(abc|efg)%’ and ‘%abc%’ || and || ‘%efg%’, but none of them seems to be working.

Advertisement

Answer

I think you want:

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement