Menggunakan subpilihan yang dapat Anda lakukan:
SELECT co.*,
(SELECT COUNT(*) FROM modules mod WHERE mod.course_id=co.id) AS moduleCount,
(SELECT COUNT(*) FROM videos vid WHERE vid.course_id=co.id) AS vidCount
FROM courses AS co
ORDER BY co.id DESC
Tapi hati-hati karena ini adalah permintaan yang mahal ketika kursus memiliki banyak baris.
EDIT: Jika tabel Anda cukup besar, kueri berikut akan berkinerja jauh lebih baik (sehingga lebih rumit untuk dibaca dan dipahami).
SELECT co.*,
COALESCE(mod.moduleCount,0) AS moduleCount,
COALESCE(vid.vidCount,0) AS vidCount
FROM courses AS co
LEFT JOIN (
SELECT COUNT(*) AS moduleCount, course_id AS courseId
FROM modules
GROUP BY course_id
) AS mod
ON mod.courseId = co.id
LEFT JOIN (
SELECT COUNT(*) AS vidCount, course_id AS courseId
FROM videos
GROUP BY course_id
) AS vid
ON vid.courseId = co.id
ORDER BY co.id DESC