楼主给出的表结构中,学生表缺少了班级名称字段
-----------------------------------------------------------
create trigger trg_insert
on 课程表
for insert
as
begin
update d
set
当前使用金额 = 当前使用金额 + (.../*费用计算*/...)
from
inserted a,
班级表 b,
学生 c,
收费表 d
where
a.班级名称 = b.班级名称
and
b.班级名称 = c.班级名称
and
c.学号 = d.学号
end
go
-----------------------------------------------------------
create trigger trg_insert
on 课程表
for insert
as
begin
update d
set
当前使用金额 = 当前使用金额 + (.../*费用计算*/...)
from
inserted a,
班级表 b,
学生 c,
收费表 d
where
a.班级名称 = b.班级名称
and
b.班级名称 = c.班级名称
and
c.学号 = d.学号
end
go
课时费由学生的实交费除以总时课就可以得到实交费了呀!