I’m not well-versed in these queries but I have been using this (and others with different post requirements) query I got from the Discourse meta site to reward posting to a particular category.
SELECT P.user_id, MIN(P.created_at) granted_at, MAX(P.id) post_id FROM badge_posts P JOIN topics T ON T.id = P.topic_id WHERE T.category_id IN (SELECT id FROM categories WHERE id = 56 OR parent_category_id = 6) AND P.user_id >= 0 GROUP BY P.user_id HAVING COUNT(*) >= 1
I was wondering how exactly I could change this to:
A) Require new TOPICS, not just posts in the category and
B) How I could include subcategories. So not just category 6, but also subcategories 7,8, and 9.
Thanks so much.