Reputation: 273
I've created simple trigger to create cloud table (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?
Upvotes: 1
Views: 1101
Reputation: 47978
Use NEW.ID
instead of LAST_INSERT_ID()
(NEW
contains all columns values of the newly inserted row in 'table'
)
Upvotes: 1