Reputation: 1
I need help to convert this expression to LINQ. In this example:
TableA[IDTABLE_A, NAME]
TableA[IDTABLE_B, IDTABLE_A, REL]
SELECT *
FROM TableA a
LEFT JOIN TableB b
ON a.IDTABLE_A = b.IDTABLE_A
AND b.IDTABLE_B = 3
Thanks in advance.
Upvotes: 0
Views: 43
Reputation: 21825
Try this:-
var query = from a in data1
join b in data2.Where(x => x.BID == 3)
on a.AID equals b.AID into ab
from c in ab.DefaultIfEmpty()
select new
{
AID = a.AID,
AName = a.AName,
BName = c == null ? "No Records" : c.BName
};
Complete Working Fiddle Here.
Upvotes: 1