Let’s say I have table1:

And table2:

And I need to filter column ID from table1 based on column ID from table2, the expected result would be:

I tried this but it never worked:
table1.AsEnumerable.Where(x => table2.AsEnumerable.Any(y => y(“ID”).ToString == x(“ID”).ToString)).CopyToDataTable
1 Like
ppr
(Peter Preuss)
2
@diego.montero.gonzalez
we can use within an assign the query syntax:
(From d In table1.AsEnumerable
Where table2.AsEnumerable.Any(Function (d2) d2("ID").ToString.Equals(d("ID").ToString))).CopyToDataTable
You just used the LINQ syntax from C# which is different
Within the method syntax it would look like:
table1.AsEnumerable.Where(Function (d) table2.AsEnumerable.Any(Function (d2) d2("ID").ToString.Equals(d("ID").ToString))).CopyToDataTable
3 Likes
I was actually looking a similar answer made by you. It worked
thank you so much!
system
(system)
Closed
4
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.