Sounds like a job for the Data Explorer plugin! Very useful, you can learn more about it here:
Here’s a stab at a SQL query that does something like this — it takes trust_level
as a parameter, and then returns a sorted list of the # of posts created in each category by users w/ that trust level (disclaimer, I’m a SQL novice, modify as needed!):
-- [params]
-- int :trust_level = 1
WITH topic_categories AS
(SELECT
t.id topic_id,
t.user_id,
t.created_at,
t.score,
c.id category_id,
c.name category_name
FROM
topics t
LEFT JOIN categories c
ON t.category_id = c.id
)
SELECT
count(tc.*) count,
tc.category_id
FROM
users u
LEFT JOIN topic_categories tc
ON u.id = tc.user_id
WHERE
tc.created_at IS NOT NULL
AND tc.category_id IS NOT NULL
AND u.trust_level = :trust_level
GROUP BY
tc.category_id
ORDER BY count DESC