在表b中插入值之后更新表a中的值 [英] Update value in table a with after insert value in table b
问题描述
亲爱的所有人,
我在这里遇到了一个问题,在这里我使用触发器自动更新在表"a"中查询的值.插入新记录后,将与表"b"区别的值.我已完成以下语法,请帮助我解决问题.谢谢
创建触发器UpdAmount;
在tblstorage.amaun_update上为每个行在tbltransaction上插入后;
开始
SET @ amtPay =(从tbltransaction的strProdID = strCntID的SELECT dblAmount)-(从tblstorage的strProdID = strCntID的SELECT amaun_update)
END
事件,当我尝试按照从互联网获得的说明进行操作时,出现一条错误消息,提示我不授予访问权限,而该访问权限需要授予当前用户"和密码",但我的PC不提供任何密码
Dear all,
I''m kind of facing a problem here where I use trigger to automatically update value that been query in table "a". The value that will be differentiate is from table "b" after new record is inserting. I have made the syntax below and kindly please help me solving my problem. Thank you
CREATE TRIGGER UpdAmount;
ON tblstorage.amaun_update AFTER INSERT ON tbltransaction FOR EACH ROW;
BEGIN
SET @amtPay=(SELECT dblAmount FROM tbltransaction WHERE strProdID = strCntID) - (SELECT amaun_update FROM tblstorage WHERE strProdID = strCntID)
END
event when I try to follow the instruction I get from internet, there are an error message stated that I doesn''t grant access which need to grant the "current user" and "password" but my PC doesn''t provide any password when I format it.
推荐答案
可能是您连接数据库的用户无权创建触发器.
与您的数据库管理员联系:您需要一个新的用户ID进行连接,或者您现有的用户需要额外的权限.
Probably what you mean is that the user under which you connected to the database does not have permission to create a trigger.
Talk to your database administrator: you either need a new user ID to connect with, or your existing user needs extra permissions.
这篇关于在表b中插入值之后更新表a中的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!