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.
| Author |
Topic |
|
helixpoint
Constraint Violating Yak Guru
291 Posts |
Posted - 2011-06-07 : 16:27:57
|
| I have a table that has an ID(Unique),emailI want to delete all duplicate emails. How do I do this?DaveHelixpoint Web Developmenthttp://www.helixpoint.com |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2011-06-07 : 17:18:31
|
There are a bunch of ways, here is one:DELETE AFROM( SELECT *, ROW_NUMBER() OVER (PARTITION BY email ORDER BY ID) AS RowNum FROM <Tablename>) AS AWHERE RowNum > 1 |
 |
|
|
|
|
|