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 (5879,5878,5891,5896,5900,5890,5416,5887,5895,5892,5885,5880,5940,5293,5911,5893,5889,5043,5057,5297,5881,5925,4776,5906,5884,5296,5905,5877,5886,5882,5899,5916,5914,5299,5897,5928,5930,5898,5902,5924,5910,5903,5918,5912,5904,5894,5909,5907,5306,5926,5929,5310,5888,5927,4762,5917,5921,5865,5908,5923,5922,5913,5919,5920,5901,5864,5915,5863,5867) GROUPBY vlogs.id ORDERBY avgrating, subs;1.28ms/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:261vtdb