Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Query to Delete Duplicate Rows

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-12-07 : 13:15:50
Rajesh S writes "Hi ,
I would like to have a single SQL Statement to delete duplicate employees from the employee table.

Thanks,
Rajesh S"

nr
SQLTeam MVY

12543 Posts

Posted - 2004-12-07 : 13:18:16
Try searching in google for
"sql server" delete duplicates

you will find
http://www.sqlteam.com/item.asp?ItemID=3331

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-12-07 : 13:27:38
You didn't use the just friggin' google it site.

Tara
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2004-12-07 : 13:55:55
oops - your memory goes when you get to my age.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

AlDragon
Starting Member

12 Posts

Posted - 2004-12-07 : 16:04:29
quote:
Originally posted by AskSQLTeam

Rajesh S writes "Hi ,
I would like to have a single SQL Statement to delete duplicate employees from the employee table.

Thanks,
Rajesh S"



If you add an identity field first

Alter table TableDelete
add integer identitiy
go

Do a select to see what you will delete
Then statement to follow
Delete T1
From TableDelete T1
Inner join TableDelete T2
On matching fields
Where T1.Ident < T2.Ident

Drop the ident if you dont want it

Alter table TableDelete
drop column Ident
go

Al Franzini
Go to Top of Page
   

- Advertisement -