/* Accumulate numeric column from all previous rows */
/* MYSQL only - another way */

SET @balance := 0;
SELECT vendor, description, amount, (@balance := @balance + amount) AS accum_total
FROM payment
ORDER BY payment_num;

SET @double := 1;
SELECT fname, lname, student_id, (@double := @double *2) AS double_value
FROM student
ORDER BY student_id;