I have this query mysql
that should only give me the sum of 2 fields grouped by month of all the years that are registered in the database.
It works partially (only the rows of the month add up to day 12 inclusive).
SQL Code:
SELECT fecha ,
SUM(entrante) AS credito,
SUM(saliente) AS debito
FROM libro
GROUP by YEAR(fecha),MONTH(fecha)
ORDER BY fecha
I am learning PHP and MYSQL and I do not know how to solve this dilemma.
Thanks ManucoBianco but I get this error