Quantcast
Channel: SQLServerCentral » Reporting Services » Reporting Services » Latest topics
Viewing all articles
Browse latest Browse all 2791

Duplicates - amended with a clearer script

$
0
0
Hello, I posted earlier with a poor script. Below is a better one.It pulls through all customers, plus their addresses, email and phone numbers.However some have duplicate surnames and addresses.Please can you advise an amendment to the script that would show which records were duplicates? Ideally I'd like the output to show where the surname, address 1 and the zipcode were identical - and restrict the output to show duplicate rows only.Many thanks. SELECT Reference.ReferenceNumber AS [Reference.ReferenceNumber) Reference.LastName Reference.FirstName Address.ReferenceNumber AS [Address.ReferenceNumber] Address.Address1 Address.Address2 Address.Address3 Address.Address4 Address.ZipCode Telephone.ReferenceNumber AS [Telephone.ReferenceNumber] Telephone.TelephoneNumber Email.ReferenceNumber AS [Email.ReferenceNumber] Email.EmailAddress FROM Reference INNER JOIN Address ON Reference.ReferenceNumber = Reference.ContactNumber LEFT OUTER JOIN Telephone ON Reference.ReferenceNumber = Telephone.ReferenceNumber LEFT OUTER Join Email ON Reference.ReferenceNumber = Email.ReferenceNumber

Viewing all articles
Browse latest Browse all 2791

Trending Articles