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 |
|
gbaia
Yak Posting Veteran
52 Posts |
Posted - 2004-05-28 : 06:32:33
|
| Hi there!I have a huge table with lots of repetition that I'm spliting into 2.However, I'm quite stuck on the SQL on how to do this.Basically, there is one field on the table that says 'no_of_copies'. If this field is >1 I want to delete all, except 1...I tried many group by queries and stuff, but, they seem to delete all the rows where no_of_copies > 1...And I don't want this!!!Thank you so much!Grazi |
|
|
mr_mist
Grunnio
1870 Posts |
Posted - 2004-05-28 : 07:18:47
|
| Do a search on here for deleting duplicates and then adapt the scripts you find to include your criteria.-------Moo. :) |
 |
|
|
vganesh76
Yak Posting Veteran
64 Posts |
Posted - 2004-05-28 : 07:42:59
|
| the possible solution isstep 1: Insert all the duplicate values into a temp table step 2: delete the duplicated records from the base table step 3 :insert the Base table by selecting distinct values from the temp tableregards,GaneshEnjoy working |
 |
|
|
gbaia
Yak Posting Veteran
52 Posts |
Posted - 2004-05-28 : 10:16:37
|
| Thank you to you both. It worked! :-)Grazi |
 |
|
|
|
|
|