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

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
});
上一篇:BZOJ 3085: 反质数加强版SAPGAP (反素数搜索)


下一篇:面向对象之对象,作用域及this