DB::select(`p.*`)
->from(`posts as p`)
->from(`comments as c`)
->where(`c.post_id`, `=`, `p.post_id`)
->groupBy(`p.post_id`)
->orderByRaw(`avg(c.mark_first) DESC`)
->orderByRaw(`avg(c.mark_second) DESC`)
->orderByRaw(`avg(c.mark_third) DESC`)
->get();