title: Get all users with duplicate email addresses
body: <p>I am writing a MySQL query where I can get all records from the user table with duplicate email addresses.</p>
  
  <p>This is the query I have so far.. my PHPMyAdmin keeps loading:</p>
  
  <pre><code>select personal_email, userid
  from user
  where personal_email in (
  select personal_email
  from user
  group by personal_email
  having count(personal_email) &gt; 1);
  </code></pre>
  
  <p>If I use the query below I get all double emails just once:</p>
  
  <pre><code>select personal_email, count(personal_email)
  from user
  group by personal_email
  having count(personal_email) &gt; 1
  </code></pre>
  
  <p>The goal is getting all the records with duplicate emails.</p>