开发者

Help with a C# linq query on entity framework objects

开发者 https://www.devze.com 2023-04-01 23:22 出处:网络
I have a Call object in Entity Framework representing a telephone call.开发者_StackOverflow社区 Can somebody help me out with a linq query?

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...

0

精彩评论

暂无评论...
验证码 换一张
取 消