I want to achieve by mysql query
+------+---------+
| frq | -any- |
+------+---------+
| 10 | 10 |
| 15 |10+15=25 |
| 15 |25+15=40 |
+------+---------+
please help with code references, thanks
I want to achieve by mysql query
+------+---------+
| frq | -any- |
+------+---------+
| 10 | 10 |
| 15 |10+15=25 |
| 15 |25+15=40 |
+------+---------+
please help with code references, thanks
IMHO, that should be handled by program logic, and not SQL. If you still want to...:
SELECT a.frq, sum(b.frq)
FROM table a
JOIN table b ON a.id >= b.id
GROUP BY a.frq
MySQL Forum helped me !!!
mysql> set @my_var=0;
mysql> select frq, @my_var:=@my_var+frq as commutative_sum from `mytable`
This works well with my mysql routines.