How to compare the Dt1 and Dt2, if they have common record based on the specific column names, generate those columns to DT3

Hello smart people

How to compare the Dt1 and Dt2,
In my case, the two table have same record based on the specific column names. Then, generate the same rows to DT3. I dont know which activity to use.

Thank you in advance

@eimon ,

1 Like

Hi @eimon try this join query using assign activitiy

DT1= (From r in DT1 join t in DT2 on r.ID equals t.ID And r.Name equals t.Name And r.City Equals t.City select DT1.clone.LoadDataRow(New Object () {r.ID,r.Name,r.City,r.Code}, False)). CopyToDataTable

Try this way
Mark it as solution if it resolves ur query

Regards

Nived N :robot:

Happy Automation :relaxed::relaxed::relaxed:

1 Like

@eimon

Option#1:
Join data table activity - Join type = InnerJoin

Option #2: LINQ Statement
We would suggest ot rely on the ID Column (assumed each name has an unique ID)

Assign activity:
left side: dtr (DataType: DataTable)
right side:

in case of an empty join result could occur, just apply following pattern:

find starter help here:
InnerJoin_1Col_getLeftCols.xaml (9.8 KB)

2 Likes

thank you @ppr

@NIVED_NAMBIAR Thank you

1 Like

Thank you @sarathi125