How to find Duplicate record And delete from table .?
Many times you can face problem of duplicate records in table.So How would you identify and delete duplicate records in a table?
select [FirstName] from TableName group by
[FirstName] having COUNT(*)>1
Then Delete duplicate records.
Delete from TableName where [id] not in (select MAX(id) from TableName group by [FirstName])
Many times you can face problem of duplicate records in table.So How would you identify and delete duplicate records in a table?
For that Firstly check if table has duplicate records or not using below query.
Then Delete duplicate records.
Delete from TableName where [id] not in (select MAX(id) from TableName group by [FirstName])
No comments:
Post a Comment