我正在使用 linq 语句
var renewalQuery = from r in crnnsupContext.Renewals
from w in crnnsupContext.WorkPlaces
join p in crnnsupContext.ProvStates on p.ProvinceStateID equals r.EmployerProvState
where r.RegNumber == _username && r.PlaceOfWork == w.WorkID
select r;
有一个r.RenewalYear
我想得到最近一年的,所以我尝试了类似的东西
var renewalQuery = from r in crnnsupContext.Renewals
group r by r.RenewalYear into g
from w in crnnsupContext.WorkPlaces
join p in crnnsupContext.ProvStates on p.ProvinceStateID equals r.EmployerProvState
where r.RegNumber == _username && r.PlaceOfWork == w.WorkID
select g.max(r.RenewalYear);
显然它不起作用,有人知道正确的语法吗?非常感谢