Hiya!
I am working on creating a badge for people that have their post marked as the solution via the solutions checkbox plugin. This is the SQL query:
SELECT
u.username AS "username",
count(*) AS "count_received_best_answer",
current_timestamp granted_at
FROM
notifications n
JOIN
users u ON n.user_id = u.id
JOIN
topics t ON n.topic_id = t.id
JOIN
categories c ON t.category_id = c.id
WHERE
n.notification_type = 14 AND
n.data LIKE '%solved.accepted_notification%' AND
n.created_at > CURRENT_DATE - INTERVAL '30 days'
GROUP BY u.username
HAVING count(*) > 0
ORDER BY count(*)
However, when I try to preview the badge, I get this error:
From searching here, I gather that q.user_id is a field in the background of these badge jobs, but I can’t figure out why I am getting this error. Any help appreciated!