Automatically Give Badge to Multiple Groups

(Hannah Jane Lister) #1

Hey there, so I’m looking to automatically grant a badge to multiple groups. I currently have this SQL section to apply the badge to one group, but I’d like to have both group_name_one and group_name_two both get the same badge.

select user_id, created_at granted_at, NULL post_id
from group_users
where group_id = (
  select from groups g where = 'group_name_one'

So, how would I create two select statements together for both groups?


(Gerhard Schlager) #2

This should work:

  gu.created_at granted_at,
  NULL          post_id
FROM group_users gu
  JOIN groups g ON ( = gu.group_id)
WHERE IN ('group_name_one', 'group_name_two')