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);
}
 
            

 

posted on 2014-12-18 15:26  【波少】  阅读(258)  评论(0编辑  收藏  举报

导航