1
I have the following SELECT
SELECT t.nome, count(t.id)
FROM Partidas p
LEFT JOIN Times t ON p.codTimeCasa = t.id
OR p.codTimeVisitante = t.id
GROUP BY t.nome
I would like him to return the teams that have no link with the table partidas
, however it only returns those who have, someone would know the solution of this problem?
Flip the sides (or the Join type) to start. SELECT FROM times LEFT JOIN matches. after all you want the teams. About returning the unlisted, that’s what I answered here: How to return only records without matching in a JOIN?
– Bacco
@Bacco was that very thank you
– Ismael Hartmann