I got a SQL Server table with columns ResolvedDate
and ResolvedBy
.
Now I want to select those two columns and count their results, which I
You have to group your data by ResolvedDate to get number of activities resolved every day.
var dates = from a in dataContext.Activities
where a.IsResolved && a.ResolvedBy == userId
group a by a.ResolvedDate into g
select new { Date = g.Key, Count = g.Count() }
To group just by day (without hour, minutes, etc.) you can change the group statement:
var dates = from a in dataContext.Activities
where a.IsResolved && a.ResolvedBy == userId
group a by a.ResolvedDate.Date into g
select new { Date = g.Key, Count = g.Count() }