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 |
ladiaocb
Yak Posting Veteran
57 Posts |
Posted - 2008-03-18 : 13:08:54
|
I accidentally imported rows into a table that already had identical rows. I'm trying to delete duplicate rows. The table looks like this:Tbl1ReportID---Reportdescription------ReportOwner1----------1st Level Calls--------User12----------1st Level Calls--------User13----------2nd Level Calls--------User24----------2nd Level Calls--------User25----------Escalations------------User3I'm trying to remove the rows using the "Reportdescription" column but I can't seem to figure out how. |
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2008-03-18 : 13:39:36
|
try this (with the select first to make sure you are only going to delete the rows you want)if it works then you can swap the DELETE with the SELECTselect t.*--delete tfrom Tbl1 tleft outer join (select min(ReportID) ReportID ,Reportdescription from Tbl1 group by Reportdescription ) d on d.Reportdescription = t.Reportdescription and d.Reportid = t.reportidwhere d.Reportdescription is NULL EDIT:forgot something important :)Be One with the OptimizerTG |
 |
|
ladiaocb
Yak Posting Veteran
57 Posts |
Posted - 2008-03-18 : 13:47:11
|
Thanks much this worked perfect!!! |
 |
|
|
|
|