以下是我的代码。 我想要做的是让每个学生的位置都基于班级的整体原始分数。 我使用'sum(assessment)'来总结整个疮。
我的错误是'[Err] 1111 - 无效使用群组功能'
SELECT
SUM(assessment) AS raw_score,
student.id,
student.fname,
student.oname,
student.lname,
class.class,
FIND_IN_SET(
SUM(assessment),
(
SELECT
GROUP_CONCAT(
DISTINCT sum(assessment)
ORDER BY
sum(assessment) DESC
)
FROM
all_exam_records
)
) AS position
FROM
all_exam_records
INNER JOIN student ON student.id = all_exam_records.student_name
INNER JOIN class ON class.id = student.class
WHERE class.id = '440'
GROUP BY class.id