Help with a C# linq query on entity framework objects
I have a Call object in Entity Framework representing a telephone call.开发者_StackOverflow社区
Can somebody help me out with a linq query?
I need to return the top 40 numbers dialed between a date range, including the number of times the number was dialed
Thanks
Sounds like you want something like:
var query = (from call in db.PhoneCalls
where call.Date >= minDate && call.Date <= maxDate
group call by call.Number into g
orderby g.Count() descending
select new { Number = g.Key, Count = g.Count() })
.Take(40);
That's just a guess based on what you've told us though...
精彩评论