# Datables operations = keep not matching values

Hello,

I have logic problem which I cannot resolve.
I have two datables with number values.
Let`s say:

dt.A

111
222
333

dt.B

111
333
444

I want to keep in new datable result, when searched value from dt.A is not present in dt.B, but, i`m not sure how to do this. When im joing datables with operation not equal(!=)

output will be like:

New.DT
coulumn1-dt.A coulumn2.dt.B
111 - 333
111 - 444
222 - 111
222 - 333
222 - 444
333 - 111
333 - 444

And well that`s correct result, because when it`s comparing(!=) “111” from dt.A with “444” from dt.B it will be true 111!=333 and then i will get that recorded added to my new DT . What i want to aquire is:

New.DT(expected)

dt.A(value not present in dt.B)

Maybe it`s simple, but i just stuck here and cannot go on :<

Thank you from above

Correct me if I am wrong, but you want to create a DataTable where the values in DtA are not present in DtB right?

If that is the case, you can use a Group Join like so →

``````(From r1 In dtA.AsEnumerable()
Group Join r2 In dtB.AsEnumerable()
On [ConditionGoesHere] Into gj = Group
From g In gj.DefaultIfEmpty()
Where IsNothing(g)
Select r1).CopyToDataTable()
``````

Kind Regards,
Ashwin A.K

1 Like

find starter help here:
GetLeftWhenMatchRight_1Col_AnyApproach.xaml (14.9 KB)
And post process it.

The join datatable activity allows us to achieve the result as well

1 Like

as an alternate approach we can do it with the help of a cartesian product

``````
(From d1 In dt1.AsEnumerable
From d2 In dt2.AsEnumerable
Where Not d1(0).toString.Equals(d2(0).toString.Trim)
Let ra = New Object(){d1(0), d2(0)}