How to exclude records with certain values in sql (MySQL)
Col1 Col2
----- -----
A 1
A 20
B 1
C 20
C 1
C 88
D 1
D 20
D 3
D 1000
E 19
E 1
Return Col1 (and Col2), but only if the value in Col2 is 1 or 20, but not if there's also another value (other than 1 or 20)
Desired result:
Col1 Col2
----- -----
A 1
A 20
B 1
But not C,D and E because there's a value in Col2 other than 1 or 20
I've used fictitious values for Col2 and only two values (1 and 20) but in real there some more.
I can use IN ('1', '20') for the values 1 and 20 but how to exclude if there's also another value in Col2. (there's no range !)