I donβt think you are telling us the whole story. In addition to orderby , which does not work with anonymous types (the code you gave was not compiled), your request should work the way you want. I just put this in LINQPad:
var objectTable = new DataTable(); objectTable.Columns.Add("resource_name",typeof(string)); objectTable.Columns.Add("day_date",typeof(DateTime)); objectTable.Columns.Add("actual_hrs",typeof(decimal)); objectTable.Rows.Add(1, DateTime.Today, 1); objectTable.Rows.Add(2, DateTime.Today, 2); var newSort = from row in objectTable.AsEnumerable() group row by new {ID = row.Field<string>("resource_name"), time1 = row.Field<DateTime>("day_date")} into grp select new { resource_name1 = grp.Key.ID, day_date1 = grp.Key.time1, Sum = grp.Sum(r => r.Field<Decimal>("actual_hrs")) }; newSort.Dump();
... and I got the following results:
resource_name1 | day_date1 | Sum 1 | 7/1/2011 12:00:00 AM | 1 2 | 7/1/2011 12:00:00 AM | 2
Stripling warrior
source share