title: Linq Select Data based on a value in another table
body: <p>I have the linq statements listed below and I want to restrict the records from one table based on the value in another table. This is the code I have which works:</p>
  
  <pre><code>using (context = new DocEntityConnection())
  {
     var Docs = context.tbDocsDetails.Where(md =&gt; md.IsCurrentDetails &amp;&amp; md.tbDoc.StatusID == 9).ToList(); 
     this.approves = context.tbDocApproves.ToList().Where(a =&gt; Docs.Select(x =&gt; x.DocID).ToList().Contains(a.DocID)).ToList();
     return Docs.Select(md =&gt; GetDataItem(md)).ToList();
  }
  </code></pre>
  
  <p>There is another table called <code>tbDocStatus</code> which has a <code>DocId</code> field too
  I would like to only return records from <code>tbDocDetails</code> where <code>tbDocdetails.DocId = tbDocStatus.DocId</code> and <code>tbDocStatus.StatusId = 4</code>.</p>
  
  <p>How would I add that to my code shown above?</p>