Duplicate Records 
Author Message
 Duplicate Records
Can anybody tell me how to select and show a list of duplicate records in a
table ?

TIA

Regards
Jonathan



Tue, 09 Dec 2003 06:16:14 GMT
 Duplicate Records

For this example, I'll list rows for which there are duplicate keys:

select
    m.*
from
    MyTable    m
join
(
select
    PK1
,   PK2
from
    MyTable
group by
    PK1
,   PK2
having
    count (*)    > 1
)    x    on    x.PK1    = m.PK1
           and  x.PK2    = m.PK2

Here, we are showing a table where the key is (PK1, PK2) but you can
generalize.

--
   Tom

----------------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCT
Columnist, SQL Server Professional

Toronto, ON Canada
www.pinnaclepublishing.com/sql
www.apress.com
---
Can anybody tell me how to select and show a list of duplicate records in a
table ?

TIA

Regards
Jonathan



Tue, 09 Dec 2003 06:44:33 GMT
 
 [ 2 post ] 

 Relevant Pages 

1. I am getting duplicate records, I mean everything is duplicate even Access record number

2. Fix Duplicate fields Rather then Duplicate Records?

3. correction :select duplicate and non duplicate record

4. select duplicate and non duplicate records

5. sorting records alphabetically and deleting duplicate records

6. Duplicate records

7. deleting duplicates records

8. duplicate records

9. Duplicate records in stored procedure resutltset with DISTINCT.

10. Duplicate records

11. Duplicate records

12. deleting duplicate records


 
Powered by phpBB® Forum Software