时间:2021-07-01 10:21:17 帮助过:12人阅读
dmrlist:合同列表
var contractMT = (from con in dmrlist join m in dc_ModelData.MaterialType.Where(p => p.MonomerProject == bidRowGuid && p.Count > 0) on con.RowGuid equals m.ContractRowGuid select new { ConName = con.Name, ConRowGuid = con.RowGuid, MTRowGuid = m.RowGuid } into jtemp group jtemp by new { jtemp.ConName, jtemp.ConRowGuid } into temp select new { ConName = temp.Key.ConName, ConRowGuid = temp.Key.ConRowGuid, MTCount = temp.Count() }).ToList(); int contractMTCount = contractMT.Count; var contractEFile = (from con in contractMT join m in dc_ModelData.MaterialType.Where(p => p.MonomerProject == bidRowGuid && p.Count > 0) on con.ConRowGuid equals m.ContractRowGuid join h in dc_ModelData.EquipmentEFile_Category.Where(p => p.BidSectionRowGuid == bidRowGuid && p.Title == "族文件") on m.RowGuid equals h.MaterialDetailRowGuid join k in dc_ModelData.EquipmentEFile.Where(p => p.IsMaxVersion == true) on h.RowGuid equals k.ParentRowGuid select new { ConName = con.ConName, ConRowGuid = con.ConRowGuid, MTRowGuid = m.RowGuid, EFileRowGuid = k.RowGuid } into jtemp group jtemp by new { jtemp.ConName, jtemp.ConRowGuid } into temp select new { ConName = temp.Key.ConName, ConRowGuid = temp.Key.ConRowGuid, EFileCount = temp.Count() }).ToList(); int contractEFileCount = contractEFile.Count;
sql三表链接查询
标签:from file count() group amp var cat class list()