Skip to content
Advertisement

SQL query to get top performer statistics per year (eg 3 pointers)

I have a table with players per year and some stats. For example (player_key, player_name, year, 3point_trials, 3point_score)

I want to have as an ouput the top performer per year (3point_score/3point_trials). If two of them have the same % then the breakeven is the the 3point_trials, whoever has the most trials.

Output would be per year

what is the SQL query for this output?

Advertisement

Answer

I would recommend window functions:

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement