向上图这样的情况 应该用哪种方法进行联表查询
第一个问题我写出来了,不知道对不对
select class 班级,count(case when sex='男' then 1 end )as 男,
count(case when sex='女' then 1 end )as 女
from table1 group by class
向上图这样的情况 应该用哪种方法进行联表查询
第一个问题我写出来了,不知道对不对
select class 班级,count(case when sex='男' then 1 end )as 男,
count(case when sex='女' then 1 end )as 女
from table1 group by class
1.
select `class`,count(id), sex from table1 group by class,sex
2.
select a.`class`, a.name, b.Yw,b.Sx from table1 a lfet join table2 b on a.id = b.id
3.
select `class`,count(*) from table1 a left join table2 b on a.id = b.id and b.Yw > 90 group by class
4.
update table2 set Yw = 95 where id = 'E9C74592A90C21D8E0533903190A764A'