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 (4517,4557,4869,4547,4518,6067,5233,5235,4594,5408,5594,6096,4558,4537,4527,5228,4520,5457,4553,5460,4550,4551,4529,4532,4539,6064,4596,4964,4572,4521,4560,4519,4544,5593,5596,4525,4564,6079,5598,5459,4533,4956,6065,4528,4538,4559,5256,4515,5869,6087,4563,4526,4541,4543,6104,4954,4948,4536,5595,5603,5462,6091,5607,4549,5461,4545,6118,4546,4542,4516,4561,4523,4530,5597,5239,4571,4535,4534,4949,4566,4570,4568,4524,4552,4941,5615,4574,4531,4565,4938,4556,4522,4548,4540,4554,4573,4567,4569,4946,4555,4562,5599,5604) GROUPBY vlogs.id ORDERBY avgrating, subs;1.74ms/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:261vtdb