我需要向 post.like_count 添加一个数字,其中 post.id = like.module_id !插入like表时的like.module_id定义
(post table) id user_id like_count
(如表) id module_id like
(如表触发器)
DELIMITER $$CREATE TRIGGER update_LikeCount
AFTER INSERT ON like FOR EACH ROW
BEGIN
UPDATE post SET hpost.like_count = post.like_count + 1
WHERE post.id = like.module_id;
END
$$DELIMITER ;