如何将此linq查询中返回的“费用”限制为指定的日期范围:
var dte = DateTime.Parse("2012-01-01");
var dte2 = DateTime.Parse("2012-02-01");
var meetingrooms = tblMeetingRoom
.Where(r => r.building_id==1)
.GroupBy(p => p.tblType)
.Select(g => new
{
TypeName = g.Key.room_type,
TypeID = g.Key.type_id,
TypeCount = g.Count(),
charges =
from rt in charges
where (rt.type_id == g.Key.type_id)
select new {
rt.chargedate,
rt.people,
rt.charge
}
});
meetingrooms.Dump();
我认为它需要介于此处:
from rt in charges
where (rt.type_id == g.Key.type_id) (EG) && rt.chargedate>=dte and rt.chargedate <dte2
select new {
感谢您的帮助,
标记
答案 0 :(得分:0)
from rt in charges
where rt.type_id == g.Key.type_id && (rt.chargedate >= dte && rt.chargedate <= dte2)
select new {
.....
答案 1 :(得分:0)
很抱歉浪费每个人的时间 - 以上作品“原样”!
标记