码迷,mamicode.com
首页 > 其他好文 > 详细

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

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

标签:des   style   blog   http   color   os   

 

 

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,并汇总求和

标签:des   style   blog   http   color   os   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!