Want to get the top-N row per group in #SQL? e.g. Top results/exam Highest paid staff/department Best score/team Number the rows per group in a subquery with ROW_NUMBER () OVER ( PARTITION BY <group_cols> ORDER BY <sort_cols> ) Then filter these values in an outer query
0
14
53
6K
12
Download Gif