Skip to content
Advertisement

Remove multiple instances of the same person, different IDs from SQL Server

I have a data set where there are individuals appearning multiple times with the same name and SSN but different personids. I want to remove those people and only keep those that appear one time.

In this instance I only want to return Roman Smith and eliminate John Thomas altogether.

I’ve been playing around with Window Functions and I’ve only managed to get this far:

Advertisement

Answer

In this scenario I like to use NOT EXISTS. Easy way to perform elimination.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement