I need a SELECT
to bring the sum of data month by month and add up with the total of the previous months.
No SELECT
below is bringing the sum month to month.
SELECT DISTINCT MONTH(data_pgto_bx) as mes, SUM(total_bx) FROM gc_baixas
WHERE sit_bx = 3 GROUP BY mes ORDER BY mes ASC
So far so good with SELECT
above, my problem is a bit more complex, I need this SELECT
to also add the total_bx
column to the previous months. Example:
-
In month 10, bring the sum of the column
total_bx
from every month to the month 10; -
In month 11 bring the sum of every month until month 11;