I am working on badge SQL that grant’s users a badge when they have all of the badges in a specified list. (E.g. id’s 3, 4 and 5).
I know this badge query works for one badge:
SELECT user_id, count(id) , current_timestamp granted_at
FROM user_badges
WHERE badge_id=4
GROUP BY user_id
But how would I make this apply to multiple badge id’s? Adding another badge_id = X
won’t work because this looks for one badge. Intersect
seems like it would work but it isn’t supported. This query would be run daily and wouldn’t target any posts.
Thanks!