Data Explorer Query - add additional parameter in export

Thanks for the quick help on this, Jay! I updated to the following, per your suggestion:

SELECT u.username, u.name
FROM badge_posts p
JOIN topics t ON p.topic_id = t.id 
JOIN users u ON p.user_id  = u.id
WHERE t.id = :topic_id
GROUP BY p.user_id,u.username

… then got this error…

PG::GroupingError: ERROR:  column "u.name" must appear in the GROUP BY clause or be used in an aggregate function
LINE 12: SELECT u.username, u.name

So I changed the query to the following and it worked like a charm! :tada:

SELECT u.username, u.name
FROM badge_posts p
JOIN topics t ON p.topic_id = t.id 
JOIN users u ON p.user_id  = u.id
WHERE t.id = :topic_id
GROUP BY p.user_id,u.username,u.name

So from my original snippet, I added the following:

To the “SELECT” line:
, u.name

To the “GROUP BY” line:
,u.name

Thanks again, @pfaffman for helping me with this syntax!