SELECT `u_id` , COUNT( `u_id` ) AS `rating`
FROM `u_h`
GROUP BY `u_id`
$query = U_h::find();
$u_rating = $query
->select(['u_id'], [count('u_id') as 'rating'])
->from('u_h')
->groupBy('u_id')
->all();