How to Filter Column of First Data table with Respect to Column of Second Data Table using Linq or Select Query

Hello Everyone,

We need Filter Data Table DT1 with Respect to Datatable DT2.
The condition is that we need keep only rows in in DT1 for which Columnname"BOID" of DT1 matches Column name “Concat” of DT2.
Please help us with any Select query or Linq query.

In LINQ we can check for

  • a join (inner, left)
  • where/any check

The Join DataTable Activity is also helpfully

Give a try on following:

(From d1 in dt1.AsEnumerable
Join d2 in dt2.AsEnumerable
On d1("BOID").toString.Trim Equals d2("Concat").toString.Trim
Select r=d1)).CopyToDataTable

check for adoption needs for:

  • handling empty results
  • handling duplicated rows based on thie join rule
1 Like

@ppr Thank you!!1

@ppr Thank you!!1

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