General developer forum

How to find List of courses using a particular Block/assignment/activity/resources

 
Picture of erika alarcon
Re: How to find List of courses using a particular Block/assignment/activity/resources
 

I use this query for Blocks


SELECT mdl_course.id as courseID, mdl_course.fullname, mdl_course.shortname, mdl_block_instances.blockname

FROM (mdl_context    mdl_context

      INNER JOIN mdl_block_instances mdl_block_instances  ON (mdl_context.id = mdl_block_instances.parentcontextid))

      INNER JOIN mdl_course mdl_course                    ON (mdl_course.id = mdl_context.instanceid)

WHERE     (mdl_block_instances.blockname = 'BLOCK_NAME')      AND (mdl_context.contextlevel = 50);


 
Average of ratings: Useful (1)