Du kan bruge vinduesfunktioner. Tricket er at tage en vinduessum af den samlede score medarbejder for hver dag, sådan:
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)
I din DB-violin , dette giver:
| 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 |