I’m looking for something similar, a badge awarded when replying to posts in a particular category.
SELECT p.user_id user_id, min(p.id) post_id, min(p.created_at) granted_at
FROM badge_posts p
JOIN topics t ON p.topic_id = t.id
WHERE t.category_id = (SELECT id FROM categories WHERE slug = 'introductions')
GROUP BY p.user_id
1 Like
Crikey, if this is what I think it is, how easy is it to adapt to specify the number of posts for silver/gold badges?
SELECT p.user_id user_id, min(p.id) post_id, min(p.created_at) granted_at
FROM badge_posts p
JOIN topics t ON p.topic_id = t.id
WHERE t.category_id = (SELECT id FROM categories WHERE slug = 'introductions')
GROUP BY p.user_id
HAVING COUNT (*) > 10
Would it be that simple?
Turns out it is. Awesome, thanks @riking!
Update: throws an error on any category name which isn’t unique.
Try:
instead?
ObOT: I note that <ins>
has been CSS’d on here, but not <del>
…