I'm not sure what to call this besides an "accumulated" column.
I have a MySQL table with a column that looks like
+---+
|val|
+---+
| 1 |
| 4 |
| 6 |
| 3 |
| 2 |
| 5 |
+---+
I want to do a query so that I get this column along with another column which is the sum of all the rows from this column so far. In other words, the select would yield
+---+----+
|val| sum|
+---+----+
| 1 | 1 |
| 4 | 5 |
| 6 | 11 |
| 3 | 14 |
| 2 | 16 |
| 5 | 21 |
+---+----+
Does anyone know how I would do this, and whether you can do this in MySQL?