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 (5392,5271,5259,5590,5420,4545,4546,5520,5258,5676,6090,6086,4437,5683) GROUPBY vlogs.id ORDERBY avgrating, subs;1.34ms/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:261vtdb