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