student表中age段缺少数据,把student2表中的的年龄age,根据相互之间的学生名字,对应的复制过来
UPDATE student a SET age= (SELECT age FROM student2 WHERE name = a.name) -- WHERE name = VALUE
一条SQL统计总数
select count(1), sum(case when money = 1 then 1 else 0 end), sum(case when type = 1 then amount else 0 end) from s_order;