Skip navigation

How can I find duplicate rows in SQL Server?

A. Issue the following query substituting tablename and column list for those columns that need checking for duplicates.

SELECT 
<list of all columns>
FROM 
tablename
GROUP BY 
<list of all columns>
HAVING 
count(*) > 1 

Learn more from How can I delete duplicate rows from a SQL Server tables? and Q. How can I remove duplicates from a list of entries?

TAGS: SQL
Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish