Marius Vasile

Marius Vasile

  • 590
  • 1.9k
  • 146.2k

asp.net core join query not showing all data

Mar 12 2021 8:26 AM
I have two table, WOMain and WOPlanner, related to each other with ID. What I want, is to run a query and add to ViewModel data from both tables, even if is there is no related data in WOPlanner. Right now, I can only see data that has records in both tables.
 
  1. WOVL = await (from a in _context.WOMains.Where(s => s.OrgID == orgid)  
  2.                           join b in _context.WOPlanners on a.WOMainID equals b.WOMainID into Temp1  
  3.                           from c in Temp1  
  4.                           select new WOViewIndex  
  5.                           {  
  6.                               WOMainID = a.WOMainID,  
  7.                               WONumber = a.WONumber,  
  8.                               WONumberS = c.WONumberS,  
  9.                               CreateDate = a.CreateDate,  
  10.                               Deficiency = a.Deficiency,  
  11.                               WOStatus = a.WOStatus  
  12.                           }).ToListAsync();  
 

Answers (4)