I still have the same question
there are 3 tables that I think I need to use to calculate the number of files (either uploaded to course page or uploaded to folder) :
mdl_resource
mdl_files
mdl_folder
but I can't calculate number of files IN folders, I don't see common field between two relation mdl_files and mdl_folder
I am using this report from ad hoc report page
==================================
SELECT COUNT(*) AS COUNT ,r.course ,c.shortname shortname ,c.fullname coursename
,( SELECT DISTINCT CONCAT(u.firstname,' ',u.lastname) FROM prefix_role_assignments AS ra JOIN prefix_user AS u ON ra.userid = u.id JOIN prefix_context AS ctx ON ctx.id = ra.contextid
WHERE ra.roleid = 3 AND ctx.instanceid = r.course AND ctx.contextlevel = 50 LIMIT 1) AS Teacher
FROM prefix_resource r JOIN prefix_course c ON r.course = c.id WHERE c.category IN (10,13,28,18,26) GROUP BY r.course ORDER BY COUNT(*) DESC