以下查询在SQL Server中正常运行。
但是如何将其转换为实体框架?
Select *
from Gp
where Teacher_id IN (SELECT Teacher_Id
FROM TW
group by Teacher_Id
having sum(Credit_Total) >= 15)
答案 0 :(得分:0)
这样的事情对你有用:
var result =
from g in Gp
from teacher in TW
group teacher by teacher.Teacher_Id into goupedTeachers
where goupedTeachers.Sum(t=>t.Credit_Total) >= 15
where g.Teacher_id == groupedTeachers.Key
select g;