Scores表

| Id | Score |
| 1  | 3.50  |
| 2  | 3.65  |
| 3  | 4.00  |
| 4  | 3.85  |
| 5  | 4.00  |
| 6  | 3.65  |

并列

| Score | Rank |
| 4.00  | 1    |
| 4.00  | 1    |
| 3.85  | 2    |
| 3.65  | 3    |
| 3.65  | 3    |
| 3.50  | 4    |
select Score,(select count(distinct Score) from Scores as b where b.Score>a.Score)+1 as Rank from Scores a order by Score desc;

不并列

select Score,(@Numb:=@Numb+1)as Rank from Scores a,(select(@Numb:=0))b order by a.Score desc;

 

相关文章:

  • 2022-12-23
  • 2023-02-02
  • 2022-01-08
  • 2022-01-28
  • 2021-04-02
  • 2022-12-23
  • 2021-06-01
猜你喜欢
  • 2021-09-27
  • 2021-06-24
  • 2021-07-28
  • 2022-12-23
  • 2021-11-29
相关资源
相似解决方案