Hello,
I need one complex query which makes partial sums on some dates.
Let's get the structure of table rates: Day Date, Amount.
01/05/2003 3,000
01/06/2003 2,000
01/09/2003 4,000
SELECT Day as DayF,SUM(Amount) as S_Am FROM rates GROUP BY Day
gives the list of totals each one from a day:
DayF S_Am
01/05/2003 3,000
01/06/2003 2,000
01/09/2003 4,000
I need the sum of the Amount from the beginning of the file until each day...something
like SUM(Amount FOR Day<DayF) on each day.
DayF S_Am
01/05/2003 3,000
01/06/2003 5,000 (I mean 3,000 on 01/05/2003 + 2,000 on 01/06/2003)
01/09/2003 9,000 (I mean 4,000 on 01/09/2003 + 3,000 on 01/05/2003 + 2,000 on
01/06/2003)
How can I do this in MySQL queries?
Thanks in advance,
Iulian