I have the secretaries table with the following structure:
Andtheworkertablewiththefollowingstructure:
Ilinkedtheworkertabletothesecretariestablethroughthefollowingrelation:
That is, I'm relating the Foreign key to the 'worker' table's primary key id of the 'secretaries' table.
But when executing the following query;
SELECT
COUNT(trabalhador.id) AS qtdtrabalhadores,
secretarias.id,
secretarias.nome,
secretarias.responsavel
FROM trabalhador
INNER JOIN secretarias
ON trabalhador.id_secretaria = secretarias.id;
... I get this error:
1140 - In aggregated query without GROUP BY, expression # 2 of SELECT list contains nonaggregated column 'cadastro-sumare.secretarias.id'; this is incompatible with sql_mode = only_full_group_by
Could anyone tell me why? Thank you in advance.