Average number of members' replies per topic (excluding staff)

Personally, I really want a group_id parameter lookup just like the user_id one :crossed_fingers: :slight_smile: - Wishlist: param dropdown for data explorer query

But until that dream comes true I use the json of the groups page to find it out eg. https://meta.discourse.org/g.json

group_id from groups json

You can do a group look-up within the query itself so it works on group names, which may be a more user-friendly way of doing it. So something like:

-- [params]
-- string :group_name

SELECT user_id, true as is_staff
    FROM group_users
    WHERE group_id = (SELECT id FROM groups WHERE name = LOWER(:group_name))

(or the hard-coded version if you didn’t want a parameter:)

SELECT user_id, true as is_staff
    FROM group_users
    WHERE group_id = (SELECT id FROM groups WHERE name = 'admins')
2 Likes