title: SQL: Filter out rows where column value occurs more than once
body: <p>I have a MySQL table that looks like this:</p>
  
  <pre><code>id    |    label
  ----------------
  1          "john"
  1          "henry"
  1          "sara"
  2          "henry"
  3          "tim"
  </code></pre>
  
  <p>So a given <code>id</code> can have multiple <code>label</code>s.  I want to keep only the rows where the <code>id</code> has a single <code>label</code>.  So the correct output for the above table would be:</p>
  
  <pre><code>id    |    label
  ----------------
  2          "henry"
  3          "tim"
  </code></pre>
  
  <p>I was thinking I should group by <code>id</code> and find the count of labels for each <code>id</code>.  Then I'd take only rows with a count of 1.  </p>
  
  <pre><code>WITH temp as
  (SELECT id
  FROM original_table
  GROUP BY id
  HAVING COUNT(id) &gt; 5)
  
  SELECT *
  FROM original_table ot
  WHERE ot.id in temp.id
  </code></pre>
  
  <p>Does that look close?</p>
  
  <p>Thanks!</p>