Query revision

Asked

Viewed 35 times

0

I have this query in order to list users with more comments, however, it cannot display users with the banned column=true.

SELECT * FROM usuarios a 
INNER JOIN topicos_comentarios b ON a.usuario = b.autor 
WHERE a.banido <> true 
GROUP BY a.usuario 
ORDER BY count(a.usuario) DESC LIMIT 3 

This select was made by a friend here, but it’s not working. Lists users usually including banned.

The structure of my users table:

inserir a descrição da imagem aqui

  • @Paulo Sérgio Filho, post the contents of his table usuarios, please

  • Users table structure: https://prnt.sc/fs0vor

  • Structure of the topical table_comments: https://prnt.sc/fs1l1r

1 answer

1


Make sure it works this way:

SELECT * FROM usuarios a 
INNER JOIN topicos_comentarios b ON a.usuario = b.autor 
WHERE a.banido = 'false'
GROUP BY a.usuario 
ORDER BY count(a.usuario) DESC LIMIT 3 

Browser other questions tagged

You are not signed in. Login or sign up in order to post.