Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
De-duplicate the provided dataset

Records will be considered duplicates if they meet all of the following conditions:

a. Last Name exact match
b. First Name fuzzy / similar match (points for creativity here)
c. Any exact match of one or more of the following:
1. Email Address
2. Full mailing Address
3. Phone Number

Once the ?? number of duplicate records are identified, they need to be merged into a single record per group, and the data merged in such a way that we have the most complete set of attributes as possible.

Example: a. If two duplicate records share an email address, but only one has a full mailing address, the resultant merged record should have both the email and the mailing address.
b. If two duplicate records have different values for one of the following, the merged record should use the more recent attribute as identified by the ModifiedOn and/or CreatedOn timestamp values

First Name
Email Address
Full Mailing Address
Phone Number
The resulting de-duplicated “Master” record needs to be appended to the source dataset, given a unique integer ID (you can seed this however you like), and then that new identifier assigned as the ParentID of the child duplicated source records.

Save and return the (now larger) dataset as a .csv file

The csv file with initial data hasthe below columns :
ID CreatedOn ModifiedOn Customer_LastName Customer_FirstName Customer_AddressLine1 Customer_City Customer_State Customer_Zip Customer_HomePhone Customer_InternetEmail

What I have tried:

> Tried parsing the csv file which contains the data into data table and filtered based on the requirements.
> Tried importing data to SQL and using the ADO.net to filter out the queries.
Posted
Updated 21-Feb-19 2:14am
Comments
ZurdoDev 18-Feb-19 15:05pm    
What is your question?
Member 10183768 18-Feb-19 15:08pm    
What logic should I use in T-SQL to get the result ?
Member 10183768 18-Feb-19 15:08pm    
What logic should I use in T-SQL to get the result ?
ZurdoDev 18-Feb-19 15:12pm    
The logic is already there. You now need to translate it into sql.
Member 10183768 18-Feb-19 15:14pm    
Can you help me translate in SQL ? I am writing a .net console application to read the data to datatable but I don't think that's a good approach.

1 solution

Here's something - about as close to an answer as you'll get - but you'll need to figure out how to use it.

TSQL: lookup how to use DISTINCT

After you see what it gives you figure out how to make use of it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900