linq——group by

多列排序&&聚合函数

var result = from i in
               (from uh in db.UserHistories
                where uh.User.UserID == UserID && uh.CRMEntityID == (int)entity
                select new { uh.ActionID, uh.ActionType, uh.ObjectID, uh.Date })
             group i by new { i.ActionID, i.ActionType, i.ObjectID } into g
             select new { g.Key.ActionID, g.Key.ActionType, g.Key.ObjectID, g.Max(uh=>uh.Date) };
 

  

上一篇:Java基础之 运算符


下一篇:PHP的会话处理函数session