How to Compare two data tables with specific Column data

Hi Team,

Here i have two data tables DT_1 and DT_2,

DT_1:

DT_1

DT_2:

DT_2

for each row in DT_2 “Phone Number” if this Phone Number is not present in DT_1 “phone” then i need to pick that data row from DT_2 and update in another excel which is DT_Final(Output). as shown below

DT_Final:

DT_Final

Please suggest any solution through LINQ

Thanks and regards,
Sai Adarsh.

Hi @adarsh_kotagiri

Can you share the sample excel file

Regards
Gokul

Hi @adarsh_kotagiri

Check out this video link

Regards
Gokul

2 Likes

Hi @Gokul001, Please find the below attachemnt

Data.xlsx (10.7 KB)

Hi,

Can you try the following sample?

DT_Final = DT_2.AsEnumerable.Where(Function(r) not DT_1.AsEnumerable.Any(Function(r2) r2("Phone").ToString=r("Phone Number").ToString)).CopyToDataTable.DefaultView.ToTable(False,{"Date","Phone Number","Currency"})

Sample20221123-2aL.zip (10.6 KB)

Regards,

3 Likes

Hi @adarsh_kotagiri

PFBL for compare two datatable using LINQ.

1 Like

Thank you so much @Yoichi , now i cleared the concept

1 Like

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