0
I have the following situation. I have a Mysql database where one of the columns (liquido_dia) brings the daily value generated (positive or negative), I’m already mounting a demonstrative per month of the value generated in the month using GROUP BY MONTH(data).
What I need now is to generate a new column (image below) with accumulated balance, always taking the value of the previous month and adding to the new month. I am programming in PHP with the database in Mysql
SQL I’m already doing
SELECT * FROM operacoes WHERE id_usuario = '{$codigoUser}' GROUP BY MONTH(data)
Screen I’m already bringing some data, but note that the ACUMUALDO column is coming to sum wrong, is what I am trying to fix in select
This will be used to check if the user is with positive or negative balance in the month and know if he should generate tax DARF or make negative compensation for the next months.
Thank you all