The Instructure Community will enter a read-only state on November 22, 2025 as we prepare to migrate to our new Community platform in early December. Read our blog post for more info about this change.
Found this content helpful? Log in or sign up to leave a like!
I'm working on an archiving scheme for our past courses. As part of this, I'm interested in finding a way to generate a report featuring all the courses that have had no user access in five or more years. How might one find this out using Canvas data?
Solved! Go to Solution.
The enrollments table has a last_activity_at value for each enrollee in a course, so you could use that to determine the last time anyone was active in each course and filter for courses that were not accessed in the last 5 years.
For example:
SELECT c.id, MAX(e.last_activity_at) AS last_activity
FROM courses c
JOIN enrollments e ON c.id = e.course_id
WHERE c.workflow_state = 'available'
GROUP BY c.id
HAVING MAX(e.last_activity_at) < now() - interval '5 years'
ORDER BY last_activity;
--Colin
The enrollments table has a last_activity_at value for each enrollee in a course, so you could use that to determine the last time anyone was active in each course and filter for courses that were not accessed in the last 5 years.
For example:
SELECT c.id, MAX(e.last_activity_at) AS last_activity
FROM courses c
JOIN enrollments e ON c.id = e.course_id
WHERE c.workflow_state = 'available'
GROUP BY c.id
HAVING MAX(e.last_activity_at) < now() - interval '5 years'
ORDER BY last_activity;
--Colin
Thank you, Colin!
Community helpTo interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign inTo interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign in