title: How to exclude records with certain values in sql
body: <p>How to exclude records with certain values in sql (MySQL)<br></p>
  
  <pre><code>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
  </code></pre>
  
  <p>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)</p>
  
  <p>Desired result:</p>
  
  <pre><code>Col1    Col2
  -----   -----
  A       1
  A       20
  B       1
  </code></pre>
  
  <p>But not C,D and E because there's a value in Col2 other than 1 or 20<br><br>
  I've used fictitious values for Col2 and only two values (1 and 20) but in real there some more.<br>
  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 !)</p>