I have this SQL in the settings of a badge and it awards a badge to anyone that gets added to the beta-testers group:
SELECT u.id AS user_id, CURRENT_TIMESTAMP AS granted_at
FROM users u
INNER JOIN group_users gu ON gu.user_id = u.id
INNER JOIN groups g ON g.id = gu.group_id
WHERE g.name = 'beta-testers'
Can I modify that to also link the badge to a specific topic ID?
SELECT
u.id AS user_id,
CURRENT_TIMESTAMP AS granted_at,
(SELECT id FROM posts WHERE topic_id = YOUR_TOPIC_ID AND post_number = 1) AS post_id
FROM users u
INNER JOIN group_users gu ON gu.user_id = u.id
INNER JOIN groups g ON g.id = gu.group_id
WHERE g.name = 'beta-testers'
Replace YOUR_TOPIC_ID
And it has to have Query targets posts ticked I think.