Why nobody answered me?
I posted two questions on this list.
1. I have a problem with MySQL 5.0 Tree compiling. The configure after I
launched configure.in made an error.
2. How could I make accumulated sums in MySQL (described in the actual
forwarded message)


----- Original Message -----
From: "Primaria Falticeni" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, June 17, 2003 5:48 PM
Subject: How the Partial SUMs are made in MySQL


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




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to