title: Finding duplicate values in a SQL table
body: <p>It's easy to find duplicates with one field:</p>
  <pre><code>SELECT email, COUNT(email) 
  FROM users
  GROUP BY email
  HAVING COUNT(email) &gt; 1
  </code></pre>
  <p>So if we have a table</p>
  <pre class="lang-none prettyprint-override"><code>ID   NAME   EMAIL
  1    John   asd@asd.com
  2    Sam    asd@asd.com
  3    Tom    asd@asd.com
  4    Bob    bob@asd.com
  5    Tom    asd@asd.com
  </code></pre>
  <p>This query will give us John, Sam, Tom, Tom because they all have the same <code>email</code>.</p>
  <p>However, what I want is to get duplicates with the same <code>email</code> <strong>and</strong> <code>name</code>.</p>
  <p>That is, I want to get &quot;Tom&quot;, &quot;Tom&quot;.</p>
  <p>The reason I need this: I made a mistake, and allowed inserting duplicate <code>name</code> and <code>email</code> values. Now I need to remove/change the duplicates, so I need to <em>find</em> them first.</p>