SQL query to find duplicate rows

This is one of those things I can never remember how to do when I need to do it. I don’t know why, it’s really quite simple:

SELECT emailaddress, firstname, lastname,
COUNT(emailaddress)
FROM customers
GROUP BY emailaddress
HAVING COUNT(emailaddress) > 1

This entry was posted in Databases and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>