left outer join using linq query syntax

var result = from p in _context.ParentTable<br/>
 join c1 in _context.ChildTable1 <br/>on p.ID equals c1.ID into pc1Table <br/>from pc1Join in pc1Table.DefaultIfEmpty()<br/>
 join c2 in _context.ChildTable2 on p.ID equals c2.ID into pc2Table from pc2Join in pc2Table.DefaultIfEmpty()
 where (c1.columnname == "value1" ||
 c2.columnname == "value2") &amp;&amp; p.columnname == "value"
 select new
 {
 pID = p.ID,
 c1ID = c1.ID,
 c2ID = c2.ID};
&nbsp;

Comments

Popular posts from this blog

storing byte array as column value in datatable using c#

post form data and bind with model : using jquery ajax in mvc

Htc sensation XL mobile not working with windows 7 or above, along with Htc sync software