Introduction
Most of the times, we use primary key or unique key for preventing
insertion of duplicate rows in SQL Server. But if we don't use these
keys, then it's obvious that duplicate rows could be entered by the
user. After inserting duplicate rows into table, it becomes a major
issue to delete those duplicate rows. In that time, we need to delete
those duplicate rows to resolve the issue. So this topic will help us to
delete those duplicate rows from the specific table.
Example:
DELETE FROM MyTable WHERE ID NOT IN ( SELECT MAX(ID) FROM MyTable GROUP BY Column1, Column2, Column3)
0 comments :
Post a Comment