两条关于生成排名的SQL语句:
select name,score,(select count(*) from t where score>a.score)+1
from t a
order by score
上面是:1,2,3,3,3,6,7...
下面是:1,2,3,3,3,4,5
select name,score,(select count(distinct score) from t where score>a.score)+1
from t a
order by score
select name,score,(select count(*) from t where score>a.score)+1
from t a
order by score
上面是:1,2,3,3,3,6,7...
下面是:1,2,3,3,3,4,5
select name,score,(select count(distinct score) from t where score>a.score)+1
from t a
order by score
博客给出两条用于生成排名的SQL语句。第一条语句生成的排名序列为1,2,3,3,3,6,7... ,第二条语句生成的排名序列为1,2,3,3,3,4,5 ,并展示了具体的SQL代码。

9351

被折叠的 条评论
为什么被折叠?



