# Return all duplicate emails and how often they appear
SELECT u1.* FROM user u1 INNER JOIN (
SELECT id, email, COUNT(*) FROM user GROUP BY email HAVING COUNT(*)>1) as u2
ON u1.email = u2.email
ORDER BY `u1`.`email` ASC

Create a free my code stock.com account now.

my code stok.com is a free service, which allows you to save and manage code snippes of any kind and programming language. We provide many advantages for your daily work with code-snippets, also for your teamwork. Give it a try!