mysql语句为:
select * from student order by subject desc limit 10; 查询总分成绩前十:mysql语句为:
select sum(subject) subject,name from student group by name order by subject desc limit 10; 注: select sum(subject) subject,name 这句的意思是:sum(subject) subject 把单科成绩加总用subject 来命名(就是总成绩),name就是一个字段,这里只有两个字段。 group by name order by subject : group by name 的意思按照名字这一栏来分组,当然,学生成绩表名字有可能是一样的,按照学号是最准确的,这里只是举个例子。
order by subject 这句的意思是按照总分成绩排序,这里的subject 是前面重命名总分的意思。
select sum(subject) as countsubject,name from student group by name order by countsubject desc limit 10;
mysql 2个as,ssm用mysql分页,mysql 查询用户积分变动,mysql存储过程select赋值,mysql 转 integer,mysql实现分布式事务管理