Can anyone help me with the equivalent LINQ query for the SQL below? I am new to LINQ
Select * From Students_History SH
Where SH.Active = 1 and SH.ModifiedAt in (
select MAX(SH1.ModifiedAt)from Students_History SH1
group by SH1.StudentId)
这是我所尝试的。
var q =
from h in Students_History
where h.Active=1
group h by h.StudentId into g
select new
{
StudentID = g.Key,
LatestModified = g.Max (x => x.ModifiedAt)
}
这里的争 que没有给我带来正确的结果,有些情况却忽视了积极标准。
我有大约十几个领域: 历史表和我希望所有这些领域不仅仅是学生。 Id and ModedAt.