カテゴリ別に質の高いユーザーを見つける方法

Was looking for how to find most valuable user in a specific category and find this, wonder how to utilize a simliar query based on category.

I was trying to query on post by category id but find the category id is not presented on posts table.