create trigger tr_base
on base
for insert,delete,update
as
update a
set 总学时=a.总学时+y.标准分数
from teaID a,(
select id,sum(标准分数) as 标准分数
from (
select id,标准分数 from inserted
union all
select id,标准分数 from deleted
) as x group by id
) as y
on base
for insert,delete,update
as
update a
set 总学时=a.总学时+y.标准分数
from teaID a,(
select id,sum(标准分数) as 标准分数
from (
select id,标准分数 from inserted
union all
select id,标准分数 from deleted
) as x group by id
) as y
解决方案 »
- sql字段自增函数——求助
- 用DTS将SQL中的数据导出到EXCEL中(已设置好格式),如何先删除EXCEL中的数据。
- 存储过程游标问题
- 求一MSsql语句
- msde2000 升级到 sql server2000 企业版需要做什么工作
- 数据库的插入问题
- 分析服务器中建立挖掘模型后处理时出错,请问各位大虾看看是怎么回事?(急)
- 求一条查询语句(急)
- 谁能告诉我如何 在delphi程序里面通过 sql语句创建一个access数据库,而不是一个表!
- java.io.IOException: No more data to read from socket
- 高手救命啊!!ACCESS不兼容问题!急!急!急!
- 急!请各位大哥看看!怎么做
create trigger tr_base
on base
for insert,delete,update
as
update a
set 总学时=a.总学时+y.标准分数
from teaID a,(
select id,sum(标准分数) as 标准分数
from (
select id,标准分数 from inserted
union all
select id,标准分数 from deleted
) as x group by id
) as y
where a.id=y.id