select *
from ( SELECT count(g.PlayerID) antal, max(p.playerName) playerName, p.TeamCategory
, row_number() over (partition by p.TeamCategory order by count(g.PlayerID) desc) r
FROM Players p
LEFT JOIN Goals g
ON g.playerID = p.PlayerID
GROUP BY p.playerID, p.TeamCategory
) sq
WHERE sq.r <= 10
|