DELETE DUPLICATE ROWS IN SQL.

Sunil Singh

Total Post:45

Points:323
Posted by  Sunil Singh
 392  View(s)
Ratings:
Rate this:

I am facing a problem in Sql. By mistake I have inserted some duplicate record. I want to delete all duplicate record ,


Can anyone tell me the query ,,,


  1. Manish Sahu

    Post:47

    Points:331
    Re: Delete duplicate rows in SQL.

    Use this query

    with SalaryCTE AS
    
    (
    select *, ROW_NUMBER() over (partition by id order by id) as rownumber from salary
    )
    DELETE from SalaryCTE where rownumber >1

    It helps you.


Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!