sql - Deletion of duplicate records using one query only -


I am using SQL Server 2005.

I have such a table -

  ID's name is 1A1A1A2B2B3C4D4D   

In this, I want to delete all duplicate entries and only retain one instance -

  ID name is 1A2B3C4D   

I can easily add another identity column to this table and do it in unique numbers. It is removing duplicate records and then. However, I want to know that I can delete duplicate records in this table without adding without adding that extra column .

In addition to this, if it can be done using only one query statement i.e. without using stored procedures or temporary tables.

Allows any one to use duplicate values ​​while maintaining unique rows To remove. Along with Q as AS (Selection RN = ROW_NUMBER () ID (Partition according to ID ID), ID, name from Qualified) Remove Q from where RN & gt; 1

Comments