I want list of user who has access the course in particular time duration, for this I have written the following SQL query can anyone tell me if this one is the best solution for my requirement.
SELECT COUNT(DISTINCT userid, courseid) FROM `mdl_logstore_standard_log` WHERE `eventname` LIKE '%course_viewed%' AND (`timecreated` BETWEEN 1609459200 AND 1617235199) And `userid` NOT IN (0,1) AND `courseid` != 1;