Erro SQL do Badge: q.user_id

Olá!

Estou trabalhando na criação de um emblema para pessoas que tiveram seus posts marcados como solução por meio do plugin de caixa de seleção de soluções. Esta é a consulta SQL:

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(*)

No entanto, ao tentar visualizar o emblema, recebo este erro:

Pesquisando aqui, entendi que q.user_id é um campo no plano de fundo desses trabalhos de emblema, mas não consigo entender por que estou recebendo esse erro. Qualquer ajuda será muito apreciada!

Your query needs to return at least the following columns:

  • user_id
  • granted_at

Also, you should definitely take a look at Add Badge to Solve answer - #2 by dax. :wink:

4 curtidas

YES. That was all I needed. Not sure why staring at it for four hours did not make it obvious. thanks much @gerhard

1 curtida

How does this differ from the Add Badge to Solve answer topic? I am looking to do the same thing but unsure if either one would be applied for every solution or a set number?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.