1
would be something like this?
SELECT COUNT(le.id) AS total_leads FROM leads AS le
INNER JOIN lojas AS lo ON le.id_loja = lo.id
GROUP BY lo.id
ORDER BY lo.id DESC
1
2
would be something like this?
SELECT COUNT(le.id) AS total_leads FROM leads AS le
INNER JOIN lojas AS lo ON le.id_loja = lo.id
GROUP BY lo.id
ORDER BY lo.id DESC
1
I would do so:
SELECT nome_loja, uf, (SELECT COUNT(*) FROM leads
WHERE loja_selecionada = nome_loja) AS 'total'
FROM lojas ORDER BY total DESC
Also of course. =)
ANIMAL! Congratulations, it was just that! Thank you!
I just made a change from order by to total and show!! Tks Brow
@Léokovaski... XD ... Quiet!
Browser other questions tagged php mysql join inner
You are not signed in. Login or sign up in order to post.
Dude, perfect!!!!! Got back to me straight! Just that NOME_LOJA did not appear in the final result. How to add this?
– Léo Kovaski
tries to put something like: SELECT COUNT(le.id) AS total_leads, store name.... See if it works.
– Ronaldo Freitas
Incidentally, in case, do you want the name of the store and the total of stores? Explain to me right this part.
– Ronaldo Freitas