I’ve created a query that retrieves course ID, user ID, and the number of sessions (logins) for students within a specific time range. This helps track student engagement at the course, term, or subaccount level.
Key Features:
- Counts distinct sessions per student within the given date range.
- Can be adjusted to fetch data for a specific course, term, or subaccount.
- If accessed_sessions is NULL, it means the student did not log in during the selected period.
SQL Query:
This query helps identify students who actively logged in during a specific period and those who never accessed the course in that timeframe.
Let me know if you have any suggestions or if you need adjustments for specific use cases!
select distinct
c.sis_source_id,
p.sis_user_id ,
( select count(distinct session_id)
from web_logs wl
where wl.user_id=e.user_id and wl.course_id=e.course_id
and wl.timestamp between '2024-09-01' and '2024-09-15' ) as Access_Times
FROM enrollments e
inner join courses c on c.id=e.course_id
inner join pseudonyms p on p.user_id=e.user_id
WHERE c.sis_source_id = 'AAAA_202425' -- This filter can be replaced by a specific account or a specific term
and e.type = 'StudentEnrollment'