Loading...Loading chart...
1WITH ranked_players AS (
2    SELECT
3        season,
4        player_id,
5        player,
6        pts_per_game,
7        x3p_per_game,
8        x2p_per_game,
9        ft_per_game,g,
10        ROW_NUMBER() OVER (
11            PARTITION BY season
12            ORDER BY pts_per_game DESC
13        ) AS rn
14    FROM @kaggle.sumitrodatta_nba_aba_baa_stats.player_per_game
15)
16SELECT
17    season,
18    SUM(pts_per_game * g) AS combined_points_top_10,
19    -- 3 points total for the top 10 players
20    SUM(x3p_per_game * 3 * g) AS total_3p_points,
21    -- 2 points total for the top 10 players
22    SUM(x2p_per_game * 2 * g) AS total_2p_points,
23    -- Free throw total for the top 10 players
24    SUM(ft_per_game * g)      AS total_ft_points
25FROM ranked_players
26WHERE rn <= 10 AND season>2000 and season<2025
27GROUP BY season
28ORDER BY season;