Find duplicate records in a table

The below query finds duplicate ‘partnumber’ values in the table ‘MYTABLE’.

select m.*
from (
    select partnumber
    from MYTABLE
    group by partnumber
    having count(*) > 1
    ) a
join MYTABLE m
on a.partnumber = m.partnumber