|
The structure of the table is simple
C_name, C_no, C_amnt, which are name, serial number, and amount
Content example:
A, 1,120.00
A, 2,150.00
A, 3,400,00
A, 4,240.00
B, 5,730.00
B.6.280.00
C, 7,30.00
The requirements are as follows. For each record with C_amnt> = 300, it is counted as 300, and then group by C_name to get its sum (C_amnt) and resumed sum (C_amnt).
This is mainly used in the lottery. There is a chance for a lottery every 100 yuan. There is a maximum of three opportunities for each product. The balance can be accumulated as one opportunity. As the above data: It should be output as:
A, 910.00,8 --- 8 = int ((120 + 150 + 300 + 240) / 100)
B, 1010.00,5 --- 5 = int ((300 + 280) / 100)
C, 30.00,0 --- 0 = int (30/100)
After thinking about it for a long time, I can't figure out how to write the condition, because the original table is data on the official server. I can't add a field to it and then update the highest value of each. Is it feasible to build a temporary table? Because that table has nearly 3 million data (all the flow since the opening). It's best if you can use a sentence, huh, huh.
Thank you in advance. |
|