title: LINQ to SQL: Two left outer join with multiple join conditions
body: <p>Here's my SQL query:</p>
  
  <pre><code>Select  &lt;a bunch of columns&gt;
  from fields f
  join Table1 c1 on c1.fieldID = f.ID and c1.year = 2014
  join Table2 fRes on f.ID = fRes.fieldID
  join Table3 stst on f.ID = stst.fieldID
  join Table4 model on c1.ID = model.yearID
  left join Table5 fA on f.ID = fA.fieldID and fA.year = 2014 
  left join Table6 nA on f.ID = nA.fieldID and nA.year = 2014 
  where  fA.sourcename IS NULL and nA.Sourcename IS NULL
  </code></pre>
  
  <p>LINQ to SQL:</p>
  
  <pre><code>from f in BasicDataAccess.Data.FieldsList
  join c1 in BasicDataAccess.Data.Table1List on f.ID equals c1.fieldID 
  join fRes in BasicDataAccess.Data.Table2List on f.ID equals fRes.fieldID
  join soilTst in BasicDataAccess.Data.Table3List on f.ID equals soilTst.fieldID
  join modelRsNM in BasicDataAccess.Data.Table4List on c1.ID equals modelRsNM.YearID
  join fA in BasicDataAccess.Data.Table5List on f.ID equals fA.fieldID into group1
  from g1 in group1.Where(fA =&gt; fA.Year == reportYear).DefaultIfEmpty()
  join nA in BasicDataAccess.Data.Table6List on f.ID equals nA.fieldID into group2
  from g2 in group2.Where(nA =&gt; nA.Year == reportYear).DefaultIfEmpty()
  where g1.sourceName == null &amp;&amp; g2.sourceName == null
  </code></pre>
  
  <p>Issue: the query when executed throws Nullreference exception was unhandled..Object reference not set to an instance of an object error..</p>
  
  <p>What am I missing? Is it possible to reference the left outer join table in where clause? Please help!</p>