# Grant a badge for all members of a group

**URL:** https://meta.discourse.org/t/grant-a-badge-for-all-members-of-a-group/18147
**Category:** Data & reporting
**Tags:** sql-triggered-badge
**Created:** [7월 27, 2014, 10:25오후 UTC](https://meta.discourse.org/t/grant-a-badge-for-all-members-of-a-group/18147 "2014-07-27T22:25:57Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [7월 27, 2014, 10:25오후 UTC](https://meta.discourse.org/t/grant-a-badge-for-all-members-of-a-group/18147/1 "2014-07-27T22:25:57Z")

</div>

I just created a badge for all the awesome [plugin authors](https://meta.discourse.org/badges).

Creating a badge targeting a group is quite easy, just type this into the SQL box:

```plaintext
select user_id, created_at granted_at, NULL post_id
from group_users
where group_id = (
  select g.id from groups g where g.name = 'GROUP_NAME_IN_LOWER_HERE'
)

```

I will add a trigger for this at some point so granting is faster, in the mean time just go to /sidekiq/scheduler and kick off the badge job to rush it.

See [Triggered custom badge queries](https://meta.discourse.org/t/triggered-custom-badge-queries/19336) for more information about custom badge SQL queries.

* * *

_Last Reviewed by @SaraDev on 2022-05-25T00:30:00Z_
