The line number income
1 1111
2 2222
3 3333
4 4444
5 5555
6 6666
Total 23331
Existing differences in 500, and then calculating the coefficient divided by the total revenue and the difference amount get income amount * coefficient, the results to keep the two, the difference between total 0.01 more than the actual and the 0.01 please change how to deal with, how to allocate to the last line, through the way of statement
Line number income contribution factor contribution amount
1, 1111, 0.021430715, 23.81
2 2222 0.021430715 47.62
3 3333 0.021430715 71.43
4 4444 0.021430715 95.24
5 5555 0.021430715 119.05
6 6666 0.021430715 142.86
Total 23331 500.01
CodePudding user response:
What do you mean share amount and and the difference value of difference to the last line number on the contributions of?CodePudding user response:
The update directly, grab the largest amount the ROWID, conditions for the updateCodePudding user response:
First want to know the difference between the data on which a record of processing, is one of the largest, and so on line number or amount of the largest, think good the rules of good processing,On the last line of your plan to deal with, for example, the first article 5 the amount of data in front of the summary, and then use a total of 500 got the last one to reduce aggregate amount data
The contribution amount,
CodePudding user response:
I want to use row_number () over function, but how can I get the largest line number, biggest line may have the sameCodePudding user response:
And rank and dense_rankCodePudding user response:
Row_number () over a sort of serial number, over () can be used inside the order desc sorting, then take sort of first line