I have two SQL Server tables...
MODULES ENROLMENTS
GroupNo StudentNo
Title GroupNo
Tutor CourseworkMark
DayNo ExamMark
Time
Room
Semester
In Access I have created a form based on another table which holds records of course numbers and names. For each course, I wish to create a subform about the modules within that particular course.
In the subform view I wish to have GroupNo, Title, Tutor, DayNo, Time, Room, Semester, Average of CourseworkMark and Average of ExamMark.
I have constructed this query
SELECT tblEnrolments.GroupNo, Tutor, DayNo, Time, Room, Semester,
AVG(CourseworkMark) AS AvgCourseworkMark, AVG(ExamMark) AS AvgExamMark
FROM tblEnrolments INNER JOIN tblModules ON tblEnrolments.GroupNo = tblModules.GroupNo
GROUP BY tblEnrolments.GroupNo;
however, I get the error
Msg 8120, Level 16, State 1, Line 1 Column 'tblModules.Tutor' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
when I run it. How do I get the Tutor, DayNo, Time, Room and Semester fields in the query as they are not part of the GROUP BY or AVG. Thank you