34,594
社区成员
发帖
与我相关
我的任务
分享
CREATE TRIGGER updatejine ON b
FOR DELETE
AS
update a
set a_sumjine=tb.sumjine
from (select sum(b_jine) as sumjine,b_bh from b ,Deleted where b.bh= Deleted.bh group by b_bh) as tb
where tb.b_bh=a_bh
CREATE TRIGGER updatejine ON b
FOR INSERT, UPDATE, DELETE
AS
update a
set a_sumjine=tb.sumjine
from (select sum(b_jine) as sumjine,b_bh from b ,inserted where b.b_bh= inserted.b_bh group by b_bh) as tb
where tb.b_bh=a_bh and inserted.b_bh = a.a_bh
CREATE TRIGGER updatejine ON b
FOR INSERT, UPDATE, DELETE
AS
update a
set a_sumjine=tb.sumjine
from (select sum(b_jine) as sumjine,b_bh from b ,inserted where b.bh= inserted.bh group by b_bh) as tb
where tb.b_bh=a_bh