I want to calculate average of grades of each student with SQL command but I encounter problem with this code. I have 3 tables related to each other and want to calculate average of student grades. This is my SQL string but it dose not work.
What is the problem with this code? Please take a look at it.
Stri = "select student.StudentID,finalgrades.finalgrade, avg(FinalGrade)" _ & "FROM (student INNER JOIN CourseStudentJunc ON Student. StudentID = CourseStudentJunc.StudentID)" _ & " INNER JOIN FinalGrades on CourseStudentJunc.JuncID = FinalGrades.JuncID group by student. StudentID " blStudent=student info(StudentID,name,...) tblcourseStudentJunc=Junction table for creating many to many relationship between course and student(JuncID,StudentID,CourseID) tblFinalGrades=saving grades of each student for each course separately (Juncid,Finalgrade)
Here is my requirement of this code:
1) First of all joining these tables
2) Calculating average of grades for each student