Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个表,其中有一个日期字段 tableA 更新记录时我想要一个触发器来检查日期字段,如果它大于某个日期,则将另一个活动字段设置为“是”
我已经尝试过,但似乎无法正确
Managed to work it out as follows, TRIGGER `active` BEFORE INSERT ON `tableA` FOR EACH ROW BEGIN IF(NEW.install_date > '1999-01-01') THEN SET NEW.active='yes'; ELSE SET NEW.active = OLD.active; END IF; END