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 |
|
rcr69er
Constraint Violating Yak Guru
327 Posts |
Posted - 2007-11-13 : 14:44:24
|
| HII've just imported data into a table, I have found there are a number of duplicate records in the table.Is there anyway to find all the duplicate records?Thanks |
|
|
DonAtWork
Master Smack Fu Yak Hacker
2167 Posts |
Posted - 2007-11-13 : 14:48:52
|
| select col1, col2 group by col1,col2having count(*)>1[Signature]For fast help, follow this link:http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspxLearn SQLhttp://www.sql-tutorial.net/ http://www.firstsql.com/tutor.htm http://www.w3schools.com/sql/default.asp |
 |
|
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2007-11-13 : 14:49:05
|
| You can use GROUP BY with HAVING COUNT(*) > 1Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-11-13 : 14:49:45
|
Yes.DELETE fFROM ( SELECT ROW_NUMBER() OVER (PARTITION BY ColA,ColB ORDER BY Col1, Col2) AS RecID ) AS fWHERE RecID > 1 E 12°55'05.25"N 56°04'39.16" |
 |
|
|
DonAtWork
Master Smack Fu Yak Hacker
2167 Posts |
Posted - 2007-11-13 : 14:55:19
|
| since this is the 2k5 forum, I bow to Peso's answer.[Signature]For fast help, follow this link:http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspxLearn SQLhttp://www.sql-tutorial.net/ http://www.firstsql.com/tutor.htm http://www.w3schools.com/sql/default.asp |
 |
|
|
|
|
|