linq 分组包含时间操作
EntityFunctions.TruncateTime linq 时间转化操作
var _date = DateTime.Now.Date; var q = from p in AdDividend.ObjectSet() where EntityFunctions.TruncateTime(p.SettlementDate) == _date group p by p.UserId into g select new { g.Key, DayMaxGold = g.Sum(p => p.GoldNum) }; if (q != null) { _DayMaxGold = q.Max(c => c.DayMaxGold); }