我在将表 1 中的值与字符串进行比较时遇到了麻烦这是我尝试过的..
DELIMITER $$
DROP TRIGGER IF EXISTS comment_trigger$$
CREATE TRIGGER comment_trigger AFTER INSERT ON post_comments
FOR EACH ROW
DECLARE
@var_post_id varchar(20);
BEGIN
IF (NEW.post_id LIKE 'rmdid%') THEN
SET @var_post_id=SELECT post_id FROM recommendations WHERE recommendation_id=NEW.post_id;
IF(@var_post_id LIKE 'recid%') THEN
UPDATE cooking_category SET last_activity=NEW.comment_time WHERE post_id=NEW.post_id;
END IF;
END IF;
END$$
DELIMITER ;
有人可以帮我解决这个问题吗?