How to delete duplicate records in sql server 2008

Delete From TableName

Where ID Not IN
{
Select MAX(ID) From TableName
Group By Col1, Col2…
}
By The help of Table name useing ID and the Group By we can delete the duplicate record from table in sql server.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s