How to Merge 3 dataTable?

Hi,
Hope all are doing well.

I wanted to know how to merge 3 data table which is having same “column” but the values are different.

as of now i was working merging 2 data table with help of LINQ : “MergeDate= Year20.AsEnumerable.union(Year21.AsEnumerable,System.Data.DataRowComparer.Default).CopyToDataTable”

Now i have to add Year22 alwell.

Thanks in advance.

1 Like

Hello,

Have you just tried to do the same thing and just replacing Year as Year22 and Year21 as MergeDate.
You can store it into a final variable named FinalMerge for example ?

HI @manipreethi410

try this

Year20.AsEnumerable.union(Year21.AsEnumerable,System.Data.DataRowComparer.Default).CopyToDataTable.AsEnumerable.Union(Year22.AsEnumerable,System.Data.DataRowComparer.Default).CopyToDataTable

Sample input
Dt


Dt1

Dt2

Sample output

Regards
Sudharsan

2 Likes

thank you.

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