Поле имя элемента в столбце Moodle

#sql #moodle

Вопрос:

Как сделать так, чтобы результат включал все имена оценок в названии столбца (заголовок), чтобы показать 3 оценки на каждого ученика? Аналогично модулю оценки moodle, но с добавлением данных о студентах. Я надеюсь, что вы мне поможете. Спасибо

 SELECT
u.firstname AS 'Nombres', 
u.lastname AS 'Apellidos',  
c.fullname AS 'Curso',
(SELECT
ROUND(gg.finalgrade,0)
FROM 
prefix_grade_items AS gi 
JOIN prefix_grade_grades AS gg ON gi.id = gg.itemid 
JOIN prefix_user AS u ON gg.userid = u.id
WHERE 
gi.itemname = 'Evaluación N° 01') AS 'nota01'
(SELECT
ROUND(gg.finalgrade,0) 
FROM 
prefix_grade_items AS gi 
JOIN prefix_grade_grades AS gg ON gi.id = gg.itemid 
JOIN prefix_user AS u ON gg.userid = u.id
WHERE 
gi.itemname = 'Evaluación N° 02') AS 'nota02'
(SELECT
ROUND(gg.finalgrade,0) AS 
FROM 
prefix_grade_items AS gi 
JOIN prefix_grade_grades AS gg ON gi.id = gg.itemid 
JOIN prefix_user AS u ON gg.userid = u.id
WHERE 
gi.itemname = 'Evaluación N° 03') AS 'nota03'
FROM prefix_course AS c 
JOIN prefix_context AS ctx ON c.id = ctx.instanceid 
JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id 
JOIN prefix_user AS u ON u.id = ra.userid 
JOIN prefix_grade_grades AS gg ON gg.userid = u.id 
JOIN prefix_grade_items AS gi ON gi.id = gg.itemid 
JOIN prefix_course_categories as cc ON cc.id = c.category
WHERE gi.courseid = c.id 
AND gi.courseid = 56