日期:2014-05-17  浏览次数:21106 次

学生成绩按总分排序后,怎样显示名次
我做了个学生成绩统计表,按总分做降序排序后,无法显示名次,相关ASP代码如下:
  </table>
  <%   grade=request.querystring( "grade ")
  banji=request.querystring( "class ")
dim   rs              
dim   sql

set   rs=server.createobject( "adodb.recordset ")
sql= "select(select   count(*)from   scores   where     language> =a.language   and   grade= "&grade& "   and   class= "&banji& "     )   as   mingci1,(select   count(*)from   scores   where   mathe> =a.mathe   and   grade= "&grade& "   and   class= "&banji& ")   as   mingci2,(select   count(*)from   scores   where   english> =a.english   and   grade= "&grade& "   and   class= "&banji& ")   as   mingci3,(select   count(*)from   scores   where   physics> =a.physics   and   grade= "&grade& "   and   class= "&banji& ")   as   mingci5,(select   count(*)from   scores   where   chemical> =a.chemical   and   grade= "&grade& "   and   class= "&banji& ")   as   mingci6,(select   count(*)from   scores   where   biological> =a.biological   and   grade= "&grade& "   and   class= "&banji& ")   as   mingci7,(select   count(*)from   scores   where   politics> =a.politics   and   grade= "&grade& "   and   class= "&banji& ")   as   mingci8,(select   count(*)from   scores   where   history> =a.history   and   grade= "&grade& "   and   class= "&banji& ")   as   mingci9,(select   count(*)from   scores   where   geography> =a.geography   and   grade= "&grade& "   and   class= "&banji& ")   as   mingci10,(select   count(*)   from   scores   where       language+mathe+english+physics+chemical+biological+politics+history+geography> =a.language+a.mathe+a.english+a.physics+a.chemical+a.biological+a.politics+a.history+a.geography     and   grade= "&grade& "   and   class= "&banji& ")   as   mingci4,*   from   scores   a   where   grade= "&grade& "   and   class= "&banji&   " "

sql= "select   *   from   scores   where       grade= "&grade& "   and   class= "&banji& "       order   by   zf   desc "   '按总分降序排列

rs.open   sql,conn,1,3


if   rs.eof   then
response.write " <font   color=red> 对不起,暂时没有相关成绩 </font> "
end   if
do   while   not   rs.eof


%>

                                     


                        <table   width= "750 "   border= "1 "   cellspacing= "0 "   cellpadding= &qu