我尝试在实体框架中实现这个 SQL 查询
select *
from students
where student.fieldid in (select fieldid from fields where groupid = 10)
我想这是一种方法:
var fields = context.fields.where(t=>t.groupid = 10).toList();
var result = context.students.where(t=> fields.Contains(t.fieldid)).toList();
但这不起作用!
有没有其他人试图做这样的事情?