1

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?

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

1 Comment

Yes, tried it after creating this question however your answer is correct. Thanks. I'm still newbie in DB game. Cheers!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.