
- Forum
- Databases
- SQL Server - How can we delete the duplicate data from a database table?
-
Junior Member
Re: How can we delete the duplicate data from a database table?
We can use Common table Expression
;With empcte(id,sal,Ranking)
as
(Select id,sal,Ranking=Dense_Rank() over (Partition by id,sal
order by newid() asc) from employee)
Delete * from empcte where Ranking>1
Regards
Smitha
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules