Alot of time duplicates needed to be deleted.
Case scenario, When one reocrd is touched it can have same data with only different dates and may end up with duplicates when joining with Id
I normally use the below script to clean it off.
with cte as (
select
Id ,row_number()over(partition by Id order by Id ) rn
from dbo.Table
)
DELETE from cte where rn>1
Case scenario, When one reocrd is touched it can have same data with only different dates and may end up with duplicates when joining with Id
I normally use the below script to clean it off.
with cte as (
select
Id ,row_number()over(partition by Id order by Id ) rn
from dbo.Table
)
DELETE from cte where rn>1