日期:2014-05-18  浏览次数:20556 次

sql 排名 并列问题


select   ROWNUM=(select   sum(1)   from   member   where   member_mark> =a.member_mark),
member_id,member_mark  
from   member   a   order   by   ROWNUM

正确的结果应该是 mopaco   是第2名才对


1,老李             ,100
3,mopaco         ,90
3,taotao3166,90
6,跑车             ,70
6,ceagle         ,70
6,小崔             ,70

------解决方案--------------------
select
ROWNUM=isnull((select count(*) from member where member_mark> a.member_mark),0)+1,
member_id,
member_mark
from
member a
order by
ROWNUM