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