/*将各个时段不同类乘客数量分别插入到表L281classify相应的列中*/
update [L281classify]
set [L281classify].Student_num=C.Amount
from [Line281] A,(select count(A.Deal_time)as Amount,A.Deal_time
from [Line281] A,[L281classify] B
where (A.Deal_time=B.Deal_time)and (A.Card_type='学生卡')
group by A.Deal_time ) C
where [L281classify].Deal_time=C.Deal_time
A、B、C为表的别名,表 [L281classify]已存在,Student_num用来记录表 [Line281]中 ,Card_type='学生卡',其Deal_time与表[L281classify]中Deal_time等值的各元组出现的次数。