我有两个表格如下:
ScholarSubject
ScholarSubjectID<pk>
ScholarID
SubjectID
Mark
和
AdmissionReq
SubjectID
DegreeCode
MinumumMark
我试图从一个学位表(用PK学位ID)上归还所有东西,在这个表中,学者的标记低于入学最低标记。
public List<object> getDegreeByAPS和Requirements()
{
using (DataLayer.CareerDatabaseEntities context = new DataLayer.CareerDatabaseEntities())
{
return (from Degrees in context.Degrees
join admissions in context.AdmissionReqs on
Degrees.DegreeCode equals admissions.DegreeCode
join subject in context.Subjects on
admissions.SubjectID equals subject.SubjectID
join scholarsubject in context.ScholarSubjects on
subject.SubjectID equals scholarsubject.SubjectID
join scholar in context.Scholars on
scholarsubject.ScholarID equals scholar.ScholarID
where Degrees.APSScore <= scholar.APSScore && admissions.MinimumMark <= scholarsubject.NSC && scholarsubject.SubjectID.Equals(admissions.SubjectID)
select Degrees).Distinct().ToList<object>();
}
}
Everything works, except if I change one of the marks (in ScholarSubject) to a lesser value than the minumum mark (in AdmissionsReq) then it still returns a degree. I want to return a degree if both marks are greater than the minimum requirements 和 not only one of the marks.
我做错什么了 有人能帮帮我吗?