我有下表:
Rank RankTies TeamName WinningPercentage
TeamA 1000
TeamB 1000
TeamC 500
TeamD 250
TeamE 250
TeamF 250
TeamG 0
我想使用存储的例程按 WinningPercentage DESC 对这些进行排名,因此更新后的表应该是:
Rank RankTies TeamName WinningPercentage
1 2 TeamA 1000
1 2 TeamB 1000
3 1 TeamC 500
4 3 TeamD 250
4 3 TeamE 250
4 3 TeamF 250
7 1 TeamG 0
我可以使用临时表来做到这一点,但有没有更优雅的解决方案,比如一个 UPDATE 语句?