I made the Select below only that it is not adding up by the correct column, where am I going wrong?
In my structure I have the dtConcat2 field and the dtConcat2 field (these dates are different one is for the date of the request and the other is for the date that made the sale) it is adding the column dtConcat2 even I placing in the select that I want the month and year of the dtConcat column
SELECT cat.id, cat.nome_vendedor, MONTH (dtConcat) AS mes, YEAR (dtConcat) AS ano,
SUM( IF( mov.tipo_venda = 'Atacado', mov.total, 0 ) ) AS Atacado
FROM lc_controle AS mov
INNER JOIN vendedor AS cat ON cat.id = mov.vendedor
where mov.exportado = 'Sim'
GROUP BY ano, mes, cat.nome_vendedor
ORDER BY nome_vendedor, ano, mes