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 |
|
GavinD1977
Yak Posting Veteran
83 Posts |
Posted - 2006-08-09 : 05:26:16
|
| Hello all. I have a table with two coulmns CODE and DESCRITPION. Can anyone suggest how i can go about deleteing the entire record where two or more codes are the same?Thanks. |
|
|
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts |
Posted - 2006-08-09 : 05:39:02
|
| [code]Delete From Tbl Where Code In (Select Code from Tbl group by Code having Count(1) >1)[/code]Chirag |
 |
|
|
GavinD1977
Yak Posting Veteran
83 Posts |
Posted - 2006-08-09 : 05:52:36
|
| Smashing. Thank you :) |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2006-08-09 : 05:54:59
|
Or this...Delete from Tbl x where exists (select Code from Tbl y where y.Code = x.Codegroup by y.Code having count(Code)>1) Harsh AthalyeIndia."Nothing is Impossible" |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-08-09 : 09:45:33
|
| http://sqlteam.com/forums/topic.asp?TOPIC_ID=6256MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|