This query fetches the courses that are the most played (result in descending order by number of plays)

Query

select
    trackings.course as course_id,
    courses.name as course_name,
    count(distinct trackings.user) as nb_learners
from qwnogpy_ww21770_datasharing.core.courses_trackings trackings
left join qwnogpy_ww21770_datasharing.core.courses courses
    on trackings.course = courses.id
group by 1, 2
order by nb_learners desc

Description