the grade_items not linked with grade_grade

the grade_items not linked with grade_grade

by Abdelrahman Magdy -
Number of replies: 0

i'm trying to use this sql 

sELECT CONCAT(u.firstname , ' ' , u.lastname) AS 'Display Name',

c.fullname AS 'Course',

SUBSTRING(cc.name,7) AS 'Category',


CASE 

  WHEN gi.itemtype = 'course' 

   THEN CONCAT(c.fullname, ' - Total')

  ELSE gi.itemname

END AS 'Item Name',


ROUND(gg.finalgrade,2) AS Grade

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.itemname = '2nd Sem.'



but in "JOIN prefix_grade_items AS gi ON gi.id = gg.itemid"

item id  in mdl_grade_grades not = id mdl_grade_items when item name = 2nd Sem.

i think i missed setting in creation '2nd Sem.' category but i need to view category total for '2nd Sem.'


Average of ratings: -