update触发器导致目标表的列设置为零,下面是代码
CREATE TRIGGER `inventory-company-update-trigger` AFTER UPDATE ON `db_company` FOR EACH ROW BEGIN UPDATE inventory_companies SET name = NEW.dc_name AND updated_at = NOW() WHERE name = OLD.dc_name; END
8zzbczxx1#
您正在使用 SET name = NEW.dc_name AND updated_at = NOW() 代码 NEW.dc_name AND updated_at = NOW() 如果失败,则结果为0可能你只是想更新两列 name 以及 updated_at 如:
SET name = NEW.dc_name AND updated_at = NOW()
NEW.dc_name AND updated_at = NOW()
name
updated_at
UPDATE inventory_companies SET name = NEW.dc_name , updated_at = NOW() WHERE name = OLD.dc_name;
1条答案
按热度按时间8zzbczxx1#
您正在使用
SET name = NEW.dc_name AND updated_at = NOW()
代码NEW.dc_name AND updated_at = NOW()
如果失败,则结果为0可能你只是想更新两列
name
以及updated_at
如: