Junior
GROUP BY
SQL & Databases
How do you find duplicate emails with a count?
Short answer: GROUP BY Email HAVING COUNT(*) > 1.
Sample solution
T-SQL
SELECT Email, COUNT(*) AS Cnt FROM Employees GROUP BY Email HAVING COUNT(*) > 1 ORDER BY Cnt DESC;
HAVING filters groups; WHERE filters rows before grouping — say that clearly.
Share this Q&A
Share preview image: https://www.toolliyo.com/images/toolliyo-logo.png