Confusing with join 2 datatables with LINQ

Hi, I have a problem when using LINQ to join 2 datatables

DT1:
image
DT2:
image

I joined them with script below:
(From a In dt1.AsEnumerable
Group Join b In dt2.AsEnumerable
On a(“number”).ToString Equals b(“number”).ToString
Into gj = Group
From g In gj.DefaultIfEmpty
Let result = New Object(){a.Field(Of Double)(“number”),g.Field(Of String)(“value”)}
Select dt3.Rows.Add(result)).CopyToDatatable

Result => which I need:
image

Result from robot => contains too many duplicate row

Anyone please help me fix this issue. Thank you in advance.

Hey @Nitiwat_Chunprapanusorn

You want to perform inner join right ?

Kindly go with Join Data Table activity & choose the type as Inner

Hope this helps.

Thanks
#nK

Hi @Nitiwat_Chunprapanusorn, Please use the below mentioned LINQ

(From InputDT1 In InputDT1.AsEnumerable() Join InputDT2 In InputDT2.AsEnumerable() On InputDT1(“number”).ToString() Equals InputDT2(“number”).ToString() Select InputDT2).ToArray().CopyToDatatable

Let me know if it is resolved. Thanks.

Assign Activity
dtResult =

(From d2 in DT2.AsEnumerable
Where DT1.AsEnumerable.Any(Function (d1) d1("number").toString().Trim().Equals(d2("number").toString.Trim))
Select r=d2).CopyToDataTable