Skip to main content
1 de 3
João Martins
  • 5,7mil
  • 5
  • 16
  • 33

Experimente desta forma:

SELECT      M.nome                  AS municipio
        ,   ISNULL(C.clientes, 0)   AS clientes
FROM        Municipio   M
LEFT JOIN   (
                SELECT      cidade
                        ,   COUNT(1) AS clientes
                FROM        Cliente
                GROUP BY    cidade
            )           C ON C.cidade = M.id
João Martins
  • 5,7mil
  • 5
  • 16
  • 33