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

7 Years
Discussion Span
Last Post by coolguy_krkr

Hi I have a similar problem around these lines...

I have following tables:
class( class_id, class_name)
student(student_id, student_name, class_id)
exam ( exam_id , class_id , exam_date )
grade( exam_id , student_id, grade )

create a list of students and ther avg grade in their last N ( n can be any number ) tests

Any help in getting this sql will be useful

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.