how to calculate the sum of points each week_number and user_name using a counter ?
I use sum() OVER (PARTITION BY ORDER BY )
And I would like to have the maximum sum at 10.
How can I do this?
Here is my original table:
Here is the result I would like to obtain:
Here is the sql code:
SELECT week_number,
user_name,
sum(points) OVER (PARTITION BY user_name ORDER BY week_number) AS total_prime
FROM team;
Try this
I don't get it in your second table where
alan
havepoint 4
but havesum 2
.