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.
我有两个表inspect,有列inspect_id (pk), inspect_loc 和duplicate_inspect有列inspect_id, inspect_loc。我需要一个 MySQL 触发器,仅当插入的数据已经可用duplicate_inspect时才将数据插入。inspect
inspect
inspect_id (pk), inspect_loc
duplicate_inspect
inspect_id, inspect_loc
例如 ..
CREATE TRIGGER duplicate BEFORE INSERT ON duplicate_inspect FOR EACH ROW BEGIN IF new.inspect_id = inspect_id THEN INSERT INTO duplicate_inspect (inspect_id,inspect_loc) values('',''); END IF; END
我现在无法测试,但您需要这些值。(我认为所有代码都可以)。