日期:2014-05-20 浏览次数:21054 次
var query=from c in Slgl_CustomerReception
where c.ProjectId==9
let id=Slgl_FollowUpRecords.Where(r=>r.CustomerId==c.id
&& r.FollowDate<=Convert.ToDateTime("2011-7-20"))
.OrderByDescending(r=>r.id).First().id
join f in Slgl_FollowUpRecords
on f.id equals id into g
from f in g.DefaultIfEmpty()
select new
{
id=c.id,
name=c.CustomersName,
names=f==null?"":f.FollowUpTheWay,
FollowDate=f==null?DateTime.Now:f.FollowDate,
fid=f==null?0:f.id
};