FKart PrmotionalBanners

Delete from Duplicate records in a table - Sql 2005

Delete from Duplicate records in Sql 2005


Table name : Duptest


first_Name      Last_Name
------------    -----------

first_name2 last_name2
first_name2 last_name2
first_name2 last_name2
first_name2 last_name2
first_name2 last_name2
first_name2 last_name2





WITH    numbered
 AS ( SELECT   first_name, row_number() OVER ( PARTITION BY first_name ORDER BY first_name ) AS nr
               FROM     duptest )
    DELETE  FROM numbered
    WHERE   nr > 1

Comments

Popular Posts