title: Fastest "Get Duplicates" SQL script
body: <p>What is an example of a fast SQL to get duplicates in datasets with hundreds of thousands of records. I typically use something like:</p>
  
  <pre><code>SELECT afield1, afield2 FROM afile a 
  WHERE 1 &lt; (SELECT count(afield1) FROM afile b WHERE a.afield1 = b.afield1);
  </code></pre>
  
  <p>But this is quite slow.</p>