Hi ,
Can you please help me code SQL query to list all students and their contact number who are absent from class.
Thanks
Aali
Bump
Hi Aalishan!
I don't know what version of moodle are you using, but i've code a query that gets the info that you are looking for.
The query:
SELECT CONCAT(u.lastname, ' ', u.firstname) as Student,
u.phone1, c.fullname as Course, FROM_UNIXTIME(ul.timeaccess) as 'Last access'
FROM moodle.mdl_user_lastaccess ul
inner join mdl_user u ON u.id = ul.userid
inner join mdl_course c ON ul.courseid = c.id
where TIMESTAMPDIFF(MONTH, FROM_UNIXTIME(ul.timeaccess),(NOW())) > 0 -- Put the Months diff
order by Student, Course
Best regards