Hi,
I have 3 data tables
Dt1 is as below:
SrNo
1
2
3
Dt2 is as below:
SrNo
4
5
3
Dt3 is as below:
SrNo
6
7
1
I need a final data table as below
Sr.no
1
2
3
4
5
6
7
Any idea?
Hi,
I have 3 data tables
Dt1 is as below:
SrNo
1
2
3
Dt2 is as below:
SrNo
4
5
3
Dt3 is as below:
SrNo
6
7
1
I need a final data table as below
Sr.no
1
2
3
4
5
6
7
Any idea?
Hi @Ray_Sha1 ,
If the schemas are same, then we can use Set Operations to solve this like, the Union Operator to be precise →
dt1.AsEnumerable().Union(dt2.AsEnumerable().Union(dt3.AsEnumerable(),DataRowComparer.Default),DataRowComparer.Default).CopyToDataTable()
If you want to order the items by any of the columns, then you can use an OrderBy as well →
dt1.AsEnumerable().Union(dt2.AsEnumerable().Union(dt3.AsEnumerable(),DataRowComparer.Default),DataRowComparer.Default).OrderBy(Function(o) CInt(o(0).ToString)).CopyToDataTable()
IntersectThreeDataTables.xaml (10.7 KB)
Kind Regards,
Ashwin A.K
@ashwin.ashok thanks!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.