Find and remove duplicates in two datatables based on values of two columns

Hello, i am trying to delete duplicate datarows from two different tables based on two columns. example 11
I have two data tables that look like the sample sheet above, where I want to delete the duplicates found based on both column C and column D. Is there a linq query that i can use to do this? Thanks in advance! :slight_smile:

@Charmaine_Matsaudza
can you help on following:
finding duplicates with 2 keys can be done similar to your post from the past:

(From d In dtData
Group d By k1=d(2).toString.Trim, k2=d(3).toString.Trim Into grp=Group
Where grp.Count =1
Select grp.First()).CopyToDatatable

duplicate datarows from two different tables based on two columns

if duplicates are to detect between the two different tables, then some more samples to the both table would be helpfully

Hey @ppr, thank you for your response. The two tables are similar. they have the same number of columns with the same headers.

@Charmaine_Matsaudza
have a look on this generic demo:
FindDupsUniquesFirstFromGroup_By2Cols.xaml (12.3 KB)

In case of you need it different please share the sample data as EXCEL with us. This would help to speed up the prototyping

3 Likes

This worked! Thank you so much :smile:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.