当我更新另一个表中列的数据时,如何修改一个表中列的数据?

时间:2021-07-13 07:25:21

I have two tables 'login' and 'editprofile' with the same column 'password'. Whenever a user edits his/her password which is under 'editprofile', it should also change the column 'password' of 'login' table. Is there a way to execute this, without joining both tables? Thanks.

我有两个表'login'和'editprofile',使用相同的列'password'。每当用户编辑“editprofile”下的密码时,它也应该更改“登录”表的“密码”列。有没有办法执行这个,而不加入两个表?谢谢。

1 个解决方案

#1


0  

What type of database are you working with? Set up a trigger on one table and have it enter the info on the other table... Something like

你在使用什么类型的数据库?在一张桌子上设置一个触发器,让它在另一张桌子上输入信息...就像

CREATE TRIGGER `Update_profile_password` AFTER UPDATE ON `login`
FOR EACH ROW UPDATE `Database`.`ProfileTable`
SET password = NEW.passwd

should start you off nicely

应该很好地开始你

#1


0  

What type of database are you working with? Set up a trigger on one table and have it enter the info on the other table... Something like

你在使用什么类型的数据库?在一张桌子上设置一个触发器,让它在另一张桌子上输入信息...就像

CREATE TRIGGER `Update_profile_password` AFTER UPDATE ON `login`
FOR EACH ROW UPDATE `Database`.`ProfileTable`
SET password = NEW.passwd

should start you off nicely

应该很好地开始你