I'm trying to select columns from 2 tables and add them together if they are using the same secondary key. Here are my tables:
assignments table
assID modID userID assName grade weighting
1 1 1 ass1 70 25
2 1 1 ass2 65 75
3 2 1 ass3 71 50
4 2 1 ass4 74 50
modules table
modID SOUD modName
1 2326 server side
2 2345 OOP
I want to find the overall grade from each module by using SUM(Grade*(Weighting/100)) and adding together the results of columns with the same modID
My current code is:
SELECT SOUD, ModuleName, SUM(Grade*(Weighting/100))
FROM `assignments`, `modules`
GROUP BY assignments.ModuleID
I've also tried
SELECT SOUD, ModuleName, SUM(Grade*(Weighting/100))
FROM `assignments`, `modules`
GROUP BY assignments.ModuleID
but neither work
Is there any way I can do this?