1
I have 3 tables:
sponsors
id | id_patrocinador | id_usuario
quotas
id | id_user | quantidade
users
id | nome | login
What I need to do is a TOP 10 where I list 10 users who have more sponsored with active quotas. For example:
1 - João - 10 indicados ativos
2 - Maria - 9 indicados aitvos
...
I tried to do the SELECT in various ways but I couldn’t get any certain result.
Did not, returned the Count(sponsors.id) all as 1... Need to check which of the sponsors.id_usuario is active in the quotas, ie quotas.status = 1
– Alisson Acioli