( the last )I would like to sum row with the same user_id ( for the column ponderation, I dont need to have other column , only user_id and ponderation)

My query
SELECT students_group.user_id,scores.result ,exam.name,exam.ponderation,exam.id, (scores.result * exam.ponderation) / totpond.totalpond as ponderation
from (
select sum(exam.ponderation) as totalpond from scores
left join exam on exam.id = scores.exam_id
left join teacher_group on teacher_group.id = exam.teacher_group_id
left join groups on groups.id = teacher_group.group_school_id
left join students_group on students_group.user_id = scores.user_id
where teacher_group.id = 54
group by students_group.user_id
) as totpond,scores
left join exam on exam.id = scores.exam_id
left join teacher_group on teacher_group.id = exam.teacher_group_id
left join groups on groups.id = teacher_group.group_school_id
left join students_group on students_group.user_id = scores.user_id
where teacher_group.id = 54
group by scores.id
order by students_group.user_id
Is it to possible to do that with my query or need to use php ? Can someone help me please ? thx 🙂
Not necessary you would just need to add the summation of that field in the query: