'Select rows that not match all items OR match not all items
I have a table A with column col. I have a list of values like val1, val2, val3.
I need select rows when col does NOT contain val1 and val2 and val3, OR col contains less than 3 values.
First condition I understand, it's like:
col NOT LIKE '%val1%' AND col NOT LIKE '%val2%' AND col NOT LIKE '%val3%'
But I have no idea how to select less than 3 values in condition.
UPD. Example data
Table A
| col
1 | sample val1
2 | sample val1 val2
3 | sample val1 val2 val3
4 | sample
5 | sample val2
6 | sample val3 val2 val1
Desired result:
| col
1 | sample val1
2 | sample val1 val2
5 | sample val2
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
