Friday 15 February 2013

Converting SQL to LINQ (left join on two fields) -



Converting SQL to LINQ (left join on two fields) -

i need help convert look linq. in example:

tablea[idtable_a, name] tablea[idtable_b, idtable_a, rel] select * tablea left bring together tableb b on a.idtable_a = b.idtable_a , b.idtable_b = 3

thanks in advance.

try this:-

var query = in data1 bring together b in data2.where(x => x.bid == 3) on a.aid equals b.aid ab c in ab.defaultifempty() select new { aid = a.aid, aname = a.aname, bname = c == null ? "no records" : c.bname };

complete working fiddle here.

sql linq

No comments:

Post a Comment