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;
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…