I have a table that looks like this:
id count 1 100 2 50 3 10
I want to add a new column called cumulative_sum, so the table wou
Sample query
SET @runtot:=0; SELECT q1.d, q1.c, (@runtot := @runtot + q1.c) AS rt FROM (SELECT DAYOFYEAR(date) AS d, COUNT(*) AS c FROM orders WHERE hasPaid > 0 GROUP BY d ORDER BY d) AS q1