欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

linq join group 博客分类: C# .NET linq join group 

程序员文章站 2024-02-05 17:36:58
...
 
 
var query = from de in dataContext.dispatchexception join d in dataContext.dispatch.Where(t => t.CreateTime >= startTime && t.CreateTime <= endTime && t.IsDeleted == 0 && (t.ShipperId == corpId || t.ConginerId == corpId || t.ReceiverId == corpId)) on de.dispatch_sn equals d.DispatchSN into j1 from j2 in j1.DefaultIfEmpty() group new { de, j2 } by de.exception_type into grouped select new { StatusType = grouped.Key, StatusCount = grouped.Count(t => t.j2.DId != null) };
 
 
 
 
 
 
 
 var reportQuery = from a in examReportTable.AsEnumerable()
                   join b in rvuTable.AsEnumerable()
                   on new { exam = a.Field<string>("exam"), examtype = a.Field<string>("examtype") } equals new { exam = b.Field<string>("rvuName"), examtype = b.Field<string>("rvuType") }
                   group b by new { reportDoc = a.Field<string>("reportDoc"), examtype = a.Field<string>("examtype") } into c
                   select new
                   {
                       DocName = c.Key.reportDoc,
                       examType = c.Key.examtype,
                       reportDocRvu = c.Sum(o => double.Parse(o.Field<string>("reportRvu"))),
                       reportDocNum =//examReportTable中对“exam”计数count这句怎么写?
                    };
 
 
 
相关标签: linq join group