Skip to main content

Cohort report

Comments

2 comments

  • Stephen Ladek

    Thanks for the question, Meaghan. Please look for a response from our CS team soon.

    0
  • Jason Rodgers

    Would something like this be what you are after?
    ----

    SELECT A.name, A.Context, B.count from

    (SELECT mdl_cohort.id, name, 
    CASE
      WHEN mdl_context.contextlevel = 10 THEN 'Site Level'
      WHEN mdl_context.contextlevel = 40 THEN (Select name FROM mdl_course_categories where mdl_context.instanceid = mdl_course_categories.id)
      WHEN mdl_context.contextlevel = 50 THEN (Select fullname FROM mdl_course where mdl_context.instanceid = mdl_course.id)
    END AS Context
    FROM mdl_cohort 
    INNER JOIN mdl_context ON mdl_cohort.contextid=mdl_context.id)A
    Left JOIN 
    (SELECT cohortid, count(*) As Count from mdl_cohort_members Group BY cohortid)B ON B.cohortid=A.id

    0

Please sign in to leave a comment.