日期:2014-05-17 浏览次数:20460 次
var blist = from p in blists group p by new { p.roleid,p.oper_type} into g select new { g.Key.oper_type, sum_gold = g.Sum(p => p.gold), sum_coupon = g.Sum(p => p.coupon), sum_copper = g.Sum(p => p.copper) }; int use = blist.Where(p => p.oper_type == 1).Sum(p => p.sum_gold); ///////////////////////////////////////////////// var blist = from p in blists group p by p.oper_type into g select new { g.Key, sum_gold = g.Sum(p => p.gold), sum_coupon = g.Sum(p => p.coupon), sum_copper = g.Sum(p => p.copper) }; int use = blist.SingleOrDefault(p => p.oper_type == 1).sum_gold;