我在Entity Framework中有一个表示电话呼叫的Call对象。
有人可以通过linq查询帮助我吗?
我需要返回日期范围之间拨打的前40个号码,包括拨打号码的次数
由于
答案 0 :(得分:3)
听起来像你想要的东西:
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);
根据您告诉我们的内容,这只是猜测......