Skip to content
Advertisement

Condition check, single/multiple value for multiple columns with comma separated column

I have the following data:

I want to find ID with the values : 7 and 4

Expected Output:

Try:

But getting wrong result:

And also I am worried about stuff clause for multiple or conditions because table is having more than 10 millions of records.

Advertisement

Answer

You could do a UNPIVOT AND XML Path, the following query should do what you want:

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