I have this table :
Name | money_earned
_______________________
john | 100
paul | 200
ringo | 300
george | 200
I want to calc ( in the most intelligent way) – near each row
What is the percentage of benefit( of each beatle) – relative to the total sum
So i want a reult like this : ( the sum is 800)
Name | money_earned| his_Percentage
__________________________________
john | 100 | 0.125
paul | 200 | 0.25
ringo | 300 | 0.375
george | 200 | 0.25
Thank 🙂
edit
I’ll be glad to have a solution like rollup does.
it count the sum , and overall sum…something like this function.
So lets say I want it in 1 query without declaring extra pre-calculated values.
1 Answer