<p>SELECT<br>    c.fullname AS "Cours",<br>    u.id AS "ID Utilisateur",<br>    CONCAT(u.firstname, ' ', u.lastname) AS "Nom complet",<br>    u.email AS "Email",<br>    COUNT(l.id) AS "Nombre total d’actions",<br>    SUM(CASE WHEN l.action = 'viewed' THEN 1 ELSE 0 END) AS "Nombre de vues",<br>    MIN(FROM_UNIXTIME(l.timecreated)) AS "Première activité",<br>    MAX(FROM_UNIXTIME(l.timecreated)) AS "Dernière activité",<br>    ROUND(COUNT(l.id) * 2, 1) AS "Temps estimé (minutes)"<br>FROM prefix_logstore_standard_log l<br>JOIN prefix_user u ON u.id = l.userid<br>JOIN prefix_course c ON c.id = l.courseid<br>WHERE l.userid != 0<br>  AND l.courseid != 1<br>GROUP BY c.id, u.id, u.firstname, u.lastname, u.email, c.fullname<br>ORDER BY c.fullname, "Temps estimé (minutes)" DESC</p>