select stu_name,zongchengji from findstudentcourse_view where c_status='期中'
我用以上语句查询学生姓名和学生成绩,数据如下:
stu_name zongchengji
aa 456
ab 487
bb 530
cc 497
dd 512
我想通过以下的查询得到学生姓名、成绩、已经成绩排名,可是没有效果
select stu_name,zongchengji,(select count(*) from findstudentcourse_view where c_status='期中' and zongchengji >=(select zongchengji from findstudentcourse_view where c_status='期中' )) as rank from findstudentcourse_view
如果希望有技术的同事,帮个忙,不胜感激
问题补充
此问题已经被我自己解决掉了,答案如下:
select c.stu_name,c.zongchengji,(select count(*) from findstudentcourse_view where c.zongchengji<=zongchengji and c_status='期中') as paiming from findstudentcourse_view c where c.c_status='期中'