how to pass parameter to trigger in mysql
i need to add one number to post.like_count where post.id = like.module_id
! like.module_id definition when insert into the like table
(post table) id user_id like_count
(like tabel) id module_id like
(like table trigger)
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 ;
No comments:
Post a Comment