это показывает проблему: «courses.name» не находится в GROUP BY
select `courses`.*, SUM(orders.amount) AS totalAmount ,
count(orders.id) AS subscribers
from `courses`
left join (select * from `orders` where `status` = 1) as `orders` on `courses`.`id` = `orders`.`course_id`
where `publish` = 1
group by `courses`.`id`
order by `subscribers` desc
limit 4
Подробнее здесь: https://stackoverflow.com/questions/785 ... -hostenger