`I am trying to perform a left join on two data tables using LinQ and there are two WHERE Clause in it. Here is a snippet of the code:
I have tried the below code snippet:
var resultList = (from p in mainlineQuery1.AsEnumerable()
join t in mainlineQuery4.AsEnumerable()//.Where(x => x.Field(“mainlineidc”) == null)
on p.Field(“globalid”) equals t.Field(“featureguid”)
into tempJoin
from temp in tempJoin.DefaultIfEmpty()
where p.Field(“circuitid2”) != null && temp.Field(“mainlineidc”) == null
select new
{
featClass = p.Field(“FeatureClass”),
globalId = p.Field(“globalid”),
circuitId = p.Field(“circuitid”),
circuitId2 = p.Field(“circuitid2”),
subtypecd = Convert.ToString(p.Field(“subtypecd”)),
operatingnumber = p.Field(“operatingnumber”) //== string.Empty ? string.Empty : temp.Field(“mainlineidc”)
}).ToList();
The number of records is not matching with the SQL Developer records.
Any help would be much appreciated!!`
vaibhav chitransh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.