By using the SQL
below to count the number of brokers in a table using INNER JOIN
, it works perfectly.
SQL:
SELECT
conta.acesso,
count(corretor.cod) as num_corr
FROM
conta
INNER JOIN corretor
ON conta.id = corretor.cod
where conta.id = '1015'
However, when trying to include the count also the user number, everything stops working. See SQL
below:
SELECT
conta.acesso,
count(corretor.cod) as num_corr,
count(usuarios.cliente) as num_user
FROM
conta
INNER JOIN corretor
ON conta.id = corretor.cod
INNER JOIN usuarios
ON conta.id = usuarios.cliente
where conta.id = '1015'
In this SQL
I only include to count the users table and nothing else works.