select sum(score) from tablegiven group by stuid;

解决方案 »

  1.   

    刚才没有排序,排序后如下:
    select stuname ,totalscore from (select stuname,sum(score) totalscore from table group by stuname) order by totalscore desc;
      

  2.   

              次表设计不合理,导致数据冗余,可分成学生成绩表和课程表,如下:        学生成绩表:        学生ID           学生姓名               课程ID       成绩 
             课程表:        课程ID         课程名称         教师ID           教师姓名 
             两表通过课程ID进行关联