U kunt vensterfuncties gebruiken. De truc is om een venstersom te nemen van de totale score per werknemer voor elke dag, zoals zo:
select
employee_name,
date(created_at) created_date,
100 * sum(score) / sum(sum(score)) over(partition by date(created_at)) monthly_score
from scores
group by employee_name, date(created_at)
In uw DB Fiddle , dit levert:
| employee_name | created_date | monthly_score |
| ------------- | ------------ | ------------- |
| John | 2020-04-01 | 30.27 |
| Bob | 2020-04-01 | 69.73 |
| John | 2020-04-02 | 15.55342 |
| Bob | 2020-04-02 | 68.42864 |
| James | 2020-04-02 | 16.01794 |