开发者

MySQL Trigger Not working

开发者 https://www.devze.com 2023-02-23 04:51 出处:网络
I\'ve created simple trigger to create cloud tabl开发者_C百科e (MyISAM table just to perfor FULL TEXT searches) however it\'s not working (the data is not being added).

I've created simple trigger to create cloud tabl开发者_C百科e (MyISAM table just to perfor FULL TEXT searches) however it's not working (the data is not being added).

DELIMITER ||

DROP TRIGGER IF EXISTS `table_cloud` ||

CREATE TRIGGER `table_cloud` AFTER INSERT ON `table`
FOR EACH ROW 
BEGIN
    INSERT INTO `table_cloud` SELECT `id`, `name`, `description` FROM `table` WHERE id = LAST_INSERT_ID();
END;
||
DELIMITER ;

Any suggestions?


Use NEW.ID instead of LAST_INSERT_ID() (NEW contains all columns values of the newly inserted row in 'table')

0

精彩评论

暂无评论...
验证码 换一张
取 消