MySQL – Get top N rows for each group

January 6, 2018

MySQL – Get top N rows for each group

Following table contains results from athletic 10K race: It contains following fields: id – autoincrement full_name – name of participant category – can be “Junior”, “Senior” and “35+” result – finish time in seconds Goal is to extract top 3 participants for each category using SQL query. Microsoft SQL Server has OVER(PARTITION BY fieldname) clause […]