开发者

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

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜