嗨,我有 2 张桌子,我想加上它。
Table 1 --> StudentId = 1 ,Score = 10 , 20 ,30 , StudentId = 2 ,Score = 5, 5
Table 2 --> StudentId = 1 ,Score = 5, 10 ,15 , StudentId = 2 ,Score = 15, 25
Total = StudentId = 1 ---> 90 , StudentId = 2 ---> 45
我使用这个查询:
Select Sum(tbl_EvaPoint.Score + tbl_ActPoint.Score ),
tbl_ActPoint.StudentId
From tbl_EvaPoint
JOIN tbl_ActPoint
ON tbl_EvaPoint.StudentId = tbl_ActPoint.StudentId
GROUP BY tbl_ActPoint.StudentId`
一切都很好,但我得到了错误的总和而不是 90 和 45 我得到了 180 和 90 或其他东西。