SELECT vlogs.id as vlog_id, youtube_statistics_subscribercount AS subs, IFNULL(avg(rating), 0) as avgrating_overall, count(*) as count_ratings, IFNULL(avg(rating_credibility), 0) as avgrating_credibility, IFNULL(avg(rating_production), 0) as avgrating_production, IFNULL(avg(rating_entertainment), 0) as avgrating_entertainment, avg(rating+rating_credibility+rating_production+rating_entertainment)/4as avgrating FROM vlogs LEFTJOIN reviews ON vlogs.id=reviews.vlog_id AND reviews.moderation_status=1WHERE vlogs.id IN (5646,5625,5672,5673,5675,5670,5674,5628,6074,5634,5627,5624,5631,5635,5623,5637,5632,5630,5633,5636,5638,5642,5640,5639,5644,5643,5641,5645) GROUPBY vlogs.id ORDERBY avgrating, subs;1.48ms/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:261vtdb