我有以下触发器(通过 mysqli 使用 PHP 生成)...
DROP TRIGGER IF EXISTS post_queue_insert;
CREATE TRIGGER post_queue_insert AFTER INSERT ON posts
FOR EACH ROW BEGIN
IF (NEW.post_type != 'revision' AND NEW.post_status != 'auto-draft') THEN
INSERT INTO event_queue (action_id, action_do, action_key, action_value, action_event, action_timestamp, sync_complete, SITE_ID) VALUES (NEW.ID, 'post', NEW.post_type, NEW.post_status, 'insert', UNIX_TIMESTAMP(now()), 0, 1);
END IF;
END;
我不知道如何检查“post_type”值是否存在于另一个表中,如果不存在则插入它。
?