清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
CREATE trigger tr_bank3 ON bank3 AFTER INSERT AS Update bank1 set bank1.fmoney=bank1.fmoney+c.a From (select fid,sum(case when TYPE=0 then fmoney when type=1 then -fmoney end) as a From bank3 group by Fid) C where C.FID=bank1.FID AND EXISTS(SELECT 1 FROM INSERTED WHERE Fid=bank3.Fid)) insert into bank1 select fid, sum(case when TYPE=0 then fmoney when type=1 then -fmoney end) as a from bank3 AS a WHERE EXISTS(SELECT 1 FROM INSERTED WHERE Fid=a.Fid) AND NOT EXISTS(SELECT 1 FROM bank1 WHERE Fid=a.Fid) group by Fid