I have a table as
id num_items folder
1 4
2 33
3 74
4 41
5 24
6 34
7 46
8 55
9 11
I want to assign folder number to rows but limiting the number of items in each folder (e.g. 100). Thus, increasing the folder number (next folder) if SUM(num_items) > 100.
The UPDATEd folder should look like
id num_items folder
1 4 1
2 33 1
3 74 2
4 41 3
5 24 3
6 34 3
7 46 4
8 55 4
9 11 5
Since, SUM make the calculation for the entire column, apparently, I need to reset the value/process of SUM after reaching the maximum item in folder.