I have many duplicate email address in my table. My current sql get’s me the total occurrence for each duplicate value, but I need to list all my duplicate email address so rather than grouping them I just want to list them. Any help appreciated.
SELECT
FirstName,
LastName,
Email,
count(Email) AS Occurance,
Company,
Country,
FROM dedupe
GROUP BY Email
HAVING ( COUNT(Email) > 1 );
SELECT
d1.FirstName
, d1.LastName
, d1.Email
, d1.Company
, d1.Country
FROM dedupe AS d1
INNER JOIN
(SELECT Email
FROM dedupe
GROUP BY Email
HAVING COUNT(*) > 1
) AS d2
ON d1.Email = d2.Email
ORDER BY d1.Email