How to compare two dataTables with different column names but with the same values?

Hello Team,

Need some guidance here.
I need to compare two datatables to find out what columns are matching.
But the challenge is the column names are not the same in both dataTables but the values in the are the ones that I have to compare.

Kindly advise,
kakooza Allan Klaus

Read them in two different datatable and then you can use a join datatable, depends on what you want to achieve when you say “compare”

Hi @rahulsharma
I read them already the challange is comparing those columns that I highlighted

did you try join datatable activity?

Keep only needed columns and perform a join as per your need.

Share the file if possible

Hi @Kakooza-Allan-Klaus

Check with the below thread for join using Linq!


Am getting an empty datatable

what join did you perform?

inner join will give you common elements, if you need to check if the data tables are identical. Do a inner join, if the result is blank that means there are two distinct and if they return some rows that means those rows are common.

again, share the file if possible and also mention what comparison you want to perform.

Yeah I did the inner join and it is working fine but I want it to return only the identical columns without the other columns

If i understood correctly you are saying you want only those 2 columns?

That can be done using Filter Datatable activity, mention in the output to keep only those columns you wish to have

No the filter datatable can’t work for this case

you just mentioned the join gave you the result so just filter that result datatable and you will get the task done

what is the reason/error that it is not working?

Remember the Filter Datatables deals with Column and Values which I don’t want now.
And also recall the matching columns have different names but same values so I want to keep the same values with different headers of my choice hope it makes sense there

You can remove columns given their names using Filter Data Table:


It partially solved my issue
Thanks @rahulsharma

1 Like

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