Want to convert this query into NOT condition

Hi All,

Below is the query which returns matching records from both DT1 and DT2, I would like to fetch records which is not present in DT2 but present in DT1.

(From d1 In in_dt_ExcelReport.AsEnumerable
Join d2 In io_dt_ContractStartDate.AsEnumerable
On d1(“Opportunity ID”).ToString Equals d2(“Opportunity ID”).ToString
Select d1).Count

@Yoichi please help.

Regards
Saranya A

@saranya_asokan
From d1 In in_dt_ExcelReport.AsEnumerable
Join d2 In io_dt_ContractStartDate.AsEnumerable
On d1(“Opportunity ID”).except(d2(“Opportunity ID”)).
Select d1).Count

@saranya_asokan
In addition to

The LINQ Join syntax has some constraints (e.g. mandatory Equals usage…) But we can rewrite to a denied match case

(From d1 In in_dt_ExcelReport.AsEnumerable()
Let o = d1("Opportunity ID").ToString().Trim()
Where Not io_dt_ContractStartDate.AsEnumerable.Any(Function (d2) d2("Opportunity ID").ToString89.Trim().Equals(o))
Select d1).Count