Hello CCD,
I’m glad to see that there are local IT companies in Maryland with SQL Server expertise. Â My colleagues and I were wondering how to get rid of duplicate rows in a SQL Server table. Â Do you know about this?
Tom in Maryland
Hello CCD,
I’m glad to see that there are local IT companies in Maryland with SQL Server expertise. Â My colleagues and I were wondering how to get rid of duplicate rows in a SQL Server table. Â Do you know about this?
Tom in Maryland
Comments are closed.
Hello Tom,
Yes, glad to hear from neighbors in Maryland! Our company is located in Gaithersburg, Maryland. Where are you located in Maryland?
Regarding your question, I am including some sample code that you can use to delete duplicate rows in SQL Server. Are you in charge of the database management for your company? Let me know if you have any difficulties with the code.
DELETE Table1
FROM Table1
LEFT OUTER JOIN (
SELECT MIN(RowId) as RowId, Column1, Column2, Column3
FROM Table1
GROUP BY Column1, Column2, Column3
) as KeepRows ON
Table1.RowId = KeepRows.RowId
WHERE
KeepRows.RowId IS NULL