0
如何通过声明LINQ如何通过声明只获取组日期的LINQ to SQL
var res = query.GroupBy( b => b.CreatedDate.ToString()).Select(c => new
{
ShredQueueCount = c.Sum(w => w.ShredQueueCount),
ShredCompletedCount = c.Sum(w => w.ShredCompletedCount),
ShredValFailureCount = c.Sum(w => w.ShredValFailureCount),
ShredExceptionCount = c.Sum(w => w.ShredExceptionCount),
CreatedDate = c.Select(w => w.CreatedDate)
});
我想只在日期获得群组。 –
@nimishjain,你的意思是按日期,而不是时间? – Habib
@nimishjain,我修改了你的答案,需要:'query.GroupBy(b => b.CreatedDate.Date)', – Habib