SQL-Code:
SELECT SUM(tmp) FROM (
SELECT weights.weight, subjects.name, SUM(grades.grade*weights.weight)/COUNT(*))/100 AS tmp
FROM grades
JOIN subjects ON grades.subject = subjects.recno
JOIN weights ON grades.weight = weights.recno
GROUP BY weights.weight, subjects.name'
) AS x;
Ist das jetzt der unveränderte Original-Code?
Dann ist das ' schonmal falsch.