delete from Scores
where playerName+'|'+cast(levelID as varchar)+'|'+cast(Difficulty as varchar)+'|'+cast(score as varchar)
in(
select playerName+'|'+cast(levelID as varchar)+'|'+cast(Difficulty as varchar)+'|'+cast(score as varchar) from
(Select rank() over (partition by cast(levelID as varchar)+'|'+cast(Difficulty as varchar) order by score desc) as bRank,*
from Scores as b) as Ranks
where Ranks.bRank >= 10)
вы можете заменить playerName + '|' + cast (levelID как varchar) + '|' + cast (Трудность как varchar) + '|' + cast (оценка как varchar) вашим первичным ключом
Это даст вам игроков в 10-м и более местах:
select Ranks.* from
(Select rank() over (partition by cast(levelID as varchar)+'|'+cast(Difficulty as varchar)
order by score desc) as bRank,*
from Scores as b) as Ranks
where Ranks.bRank >= 10
Результат:
bRank playerName LevelID Score Difficulty
-------------------- -------------------------------------------------- ----------- ----------- -----------
10 Player 3 1 3 10
11 Player 2 1 2 10
12 Player 1 1 1 10