Спасибо,работает. Правда в нижеуказанном запросе не могу поставить MAX(timemodified). Куда ее вписать?
SELECT u.firstname AS 'First' , u.lastname AS 'Last',
c.fullname AS 'Course',
cc.name AS 'Category',
gi.itemname AS 'Mark name',
ROUND(ggh.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_history AS ggh ON ggh.userid = u.id
JOIN prefix_grade_items AS gi ON gi.id = ggh.itemid
JOIN prefix_course_categories AS cc ON cc.id = c.category
WHERE gi.courseid = c.id AND gi.itemname='Attendance' AND ggh.finalgrade<85 AND ggh.timemodified<=1419984000
ORDER BY cc.name