혹시 다른 분들이 필요하실 수 있을까 봐 쿼리를 완성해서 남겨 둡니다:
select ua.user_id, u.username, sum(action_type) actions, sum(case action_type when 5 then 1 else 0 end) replies from user_actions ua
join users u on u.id = ua.user_id
join topics t on target_topic_id = t.id
where ua.created_at > 'YYYY-MM-DD'::date and t.category_id = CATEGORY_ID
group by ua.user_id, u.username;
YYY-MM-DD를 원하는 기준 날짜로, CATEGORY_ID를 해당 카테고리 ID로 교체하면 됩니다.
결과에는 user_id, username, actions, replies가 표시됩니다.