title: Show related records according to the Id from another Table
body: <p>In my ASP.NET MVC application, I have created an HTML Table using the view model.</p>
  <p>For this, I have written a query that shows only the data that <code>ReOrderQty</code> is !=0 and <code>AvaQty</code> is less than <code>ReOrderQty</code>.</p>
  <pre><code>List &lt; RecognizedPartsViewModel &gt; Reco = new List &lt; RecognizedPartsViewModel &gt; ();
  
  var rData = (from i in db.InventoryMain 
               join p in db.PartCategory on i.PartCatogary equals p.Id 
               where i.ReOrderQty != 0 &amp;&amp; i.AvaQty &lt;= i.ReOrderQty &amp;&amp; i.PartCatogary != 0
               select new RecognizedPartsViewModel {
               Id = i.Id,
               PartNo = i.PartNo,
               Description = i.PartDescription,
               Model = i.PartModel,
               AvaQty = i.AvaQty,
               ReOrderQty = i.ReOrderQty,
               PartCato = i.PartCatogary,
               ABCD = i.A_B_C_D_Category
  
               }).ToList();
  
  </code></pre>
  <p>So as so far, table data is showing according to the query.</p>
  <p>There is another table where I store Orders according to the <code>PartId</code>. So I want to show that data on another column in the same HTML Table.</p>
  <p>I can get those details by joining the <code>join ord in db.OrderTable on i.Id equals ord.PartNo_Id</code>
  but when it does results only show the PartNumbers that only contains on the <code>OrderTable</code> only.</p>
  <p>This is how I modified it as I mention.</p>
  <pre><code>List &lt; RecognizedPartsViewModel &gt; Reco = new List &lt; RecognizedPartsViewModel &gt; ();
  
  var rData = (from i in db.InventoryMain 
               join p in db.PartCategory on i.PartCatogary equals p.Id 
               join ord in db.OrderTable on i.Id equals ord.PartNo_Id 
               where i.ReOrderQty != 0 &amp;&amp; i.AvaQty &lt;= i.ReOrderQty &amp;&amp; i.PartCatogary != 0
  
      select new RecognizedPartsViewModel {
          Id = i.Id,
              PartNo = i.PartNo,
              Description = i.PartDescription,
              Model = i.PartModel,
              AvaQty = i.AvaQty,
              ReOrderQty = i.ReOrderQty,
              PartCato = i.PartCatogary,
              ABCD = i.A_B_C_D_Category,
              PastOrders = &quot;Order Qty: &quot; + ord.OrderQty
  
      }).ToList();
  
  </code></pre>
  <p>So, when this does like I was said earlier not show every record, it shows only the record in the <code>ordertable</code>.</p>
  <p>So how I can show those tables within the same view without losing my main requirement?</p>