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 |
|
Topaz
Posting Yak Master
199 Posts |
Posted - 2008-06-05 : 06:40:03
|
| how can i find duplicates in my database? i want to find them in the website and expressemail field |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-06-05 : 07:03:25
|
| SELECT websiteFROM TableGROUP BY websiteHAVING COUNT(*) >1 |
 |
|
|
Topaz
Posting Yak Master
199 Posts |
Posted - 2008-06-05 : 07:47:52
|
| what is the group by function never heard of that?this just seems to bring up a list of websites that i guess are duplicates. how can it to show me every single duplicate record? |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-06-05 : 07:49:36
|
quote: Originally posted by Topaz what is the group by function never heard of that?this just seems to bring up a list of websites that i guess are duplicates. how can it to show me every single duplicate record?
Are you using SQL 2005 or sql 2000? |
 |
|
|
Topaz
Posting Yak Master
199 Posts |
Posted - 2008-06-05 : 07:51:55
|
| 2005 |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-06-05 : 07:54:10
|
| [code]SELECT *FROM(SELECT ROW_NUMBER() OVER(PARTITION BY website ORDER BY PKCol) AS RowNo,*FROM YourTable)tWHERE t.RowNo>1[/code]where PKCol is the primary key of your table |
 |
|
|
|
|
|