摘要:
一张sc表有(s_id,c_id,score)查询条件按照s_id的平均score排名次首先select s_id,avg(score) from sc group by s_id;名次就是;比如说s_id=2的名次就是平均分比他大的人数+1,这样让上面2个表as T1,AS T2,T1.avg(score)>T2.avg(score)select 1+(select count(*) from (select s_id,avg(score) as 平均成绩 from sc group by s_id) as T1 where T1.平均成绩>T2.平均成绩)as RANK,s_i 阅读全文