首页 > 其他 > 详细

Entity Framework Lambda 实现多列Group by,并汇总求和

时间:2014-07-06 22:08:46      阅读:1612      评论:0      收藏:0      [点我收藏+]

 

 

bubuko.com,布布扣
var result = DataSummaryRepository.FindBy(x => x.UserID == argMemberNo && x.SummaryDate <= argEndDate && x.SummaryDate >= argStarDate).OrderByDescending(x => x.SummaryDate).GroupBy(x => new { x.SummaryDate, x.UserID }).Select(g => new
            {
                PV = g.Sum(x => x.PV),
                UV = g.Sum(x => x.UV),
                OrderQunantity = g.Sum(x => x.OrderQunantity),
                OrderAmount = g.Sum(x => x.OrderAmount),
                CommissionEstimate = g.Sum(x => x.CommissionEstimate),
                AvaliableCommission = g.Sum(x => x.AvaliableCommission),
                HistoryCommission = g.Sum(x => x.HistoryCommission),
                SummaryDate = g.Key.SummaryDate,
                UserID = g.Key.UserID
            });
View Code

 

 

 

Entity Framework Lambda 实现多列Group by,并汇总求和,布布扣,bubuko.com

Entity Framework Lambda 实现多列Group by,并汇总求和

原文:http://www.cnblogs.com/xuxu-dragon/p/3824427.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!