Arrumei o código, ficou assim:
SELECT distinct g.name AS POLO, c.fullname AS DISCIPLINA , u.username,u.firstname, u.lastname,
(SELECT from_unixtime(timeaccess, '%d/%m/%Y %H:%i:%s') as ULTIMO_ACESSO
FROM ava_poliseducacional_com_br.mdl_user_lastaccess la
WHERE la.userid = u.id AND la.courseid = c.id) AS ULTIMO_ACESSO
FROM mdl_course AS c
JOIN mdl_groups AS g ON g.courseid = c.id
JOIN mdl_groups_members AS m ON g.id = m.groupid
JOIN mdl_user AS u ON m.userid = u.id
JOIN mdl_role_assignments AS rs ON rs.userid = u.id
#WHERE g.name = ' ' --> Caso queira filtrar por grupo
#AND rs.roleid = ' ' --> Caso queira filtrar por cargo ex: 4=tutor 5=estudante
#AND u.id = '' --> Caso queira filtrar por usuario
ORDER BY POLO,DISCIPLINA