Finding duplicate in Tsql
Posted on 2011-10-12
I'm trying to bring back not only duplicates but also additional information.
I know the ssn is duplicated. I need to also bring back the rowid, and names but when I include those it pairs down the list. The names may or may not match (some last names have Xxx in front of the duplicate)
Using this code I get 49 rows returned with the dup count
SELECT [ssnum], count(ssnum)
where org = 'VKSPA'
group by ssnum
having count(ssnum) > 1
I want to also get the ptId (unique table key), f_name, m_name, And l_name.
Can someone show me how to do this without reducing the results?