Discourse AI + Data Explorer?

I think if you come up with one worth sharing with the community you can pop it in a new topic in data & reporting. There’s a new 'share conversation` button too that could be useful for this - Share Your AI Bot Conversations!

Building a Query to Locate Plugin Authors AI

JammyDodger:

Hey Bert :slight_smile:

Can you write me a query that will find all the users in the plugin_authors group?

gpt4_bot:

Look up database schema

groups, group_users, users

Now that we have the schema for the relevant tables, we can write a query to find all the users in the ‘plugin-authors’ group. Based on the schema, we’ll need to join the group_users table with the groups and users tables to get the usernames of the members of the ‘plugin-authors’ group.

Here’s the query to find all the users in the ‘plugin-authors’ group:

SELECT u.id AS user_id, u.username
FROM users u
JOIN group_users gu ON gu.user_id = u.id
JOIN groups g ON g.id = gu.group_id
WHERE g.name = 'plugin_authors'

This query selects the user ID and username from the users table by joining with the group_users table on the user_id and then joining with the groups table on the group_id. It filters the results to include only those users who are part of the group with the name ‘plugin-authors’.

2 Likes