欢迎投稿

今日深度:

mysql 查询表中平均分最低的班级

mysql 查询表中平均分最低的班级


复制代码 代码如下:

drop table if exists dd;
create table dd (
user_id int ,
class_no int ,
score int
);
insert into dd values (1,1,1), (2,1,1), (3,1,2), (4,2,2);
select class_no ,avg(score)from dd group by class_no order by avg(score);

在MySQL下面测试通过。

www.htsjk.Com true http://www.htsjk.com/Mysql/12706.html NewsArticle mysql 查询表中平均分最低的班级 复制代码 代码如下: drop table if exists dd; create table dd ( user_id int , class_no int , score int ); insert into dd values (1,1,1), (2,1,1), (3,1,2), (4,2,2); select class_no ,avg(score)...
评论暂时关闭