多列排序&&聚合函数

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

  

相关文章: