Hi Nadya,
I think i have found it.
Just a simple thought, but it looks like it works with two different sql statements.
The first is the same like you said.
(I created something alike to test)
* Sample data
Jaar=Year
Maand=Month
Bedrag=Amount
table1 && same as first select
Jaar Maand
1999 01
2000 01
2000 02
2000 04
Table2 && original table
Jaar Maand Bedrag
2000 01 10
2000 01 10
2000 04 40
1999 01 1
2000 04 40
2000 02 20
SQL
select table1.maand,table1.jaar,table1.maand+table1.jaar,sum(table2.bedrag);
from table1,table2;
where table2.jaar=table1.jaar and table2.maand between '01' and table1.maand;
group by 3
Output:
Month Year Dummy Tot_Amount
01 1999 011999 1
01 2000 012000 20
02 2000 022000 42
04 2000 042000 122