In MySQL:
- I have an
interviewtable, and - when a new interview is created (a row inserted into
interview), - I want to add rows to a child table
interview_questionstable linking to the question definitions ininterview_questions_template.
I'm trying to do this in an AFTER INSERT trigger on interview, and mysql is saying I have a syntax error at the end of my INSERT INTO ... SELECT statement.
I've tried joining with NEW, thinking it might be a table, but that didn't work either. Gander at the code?
CREATE TRIGGER interview_AFTER_INSERT AFTER INSERT ON interview
FOR EACH ROW
BEGIN
INSERT INTO interview_questions (id_interview, id_candidate, id_question_def, s_userid)
SELECT NEW.id_interview, NEW.id_candidate, interview_question_template.id_question_def, NEW.s_userid
FROM interview_question_template;
END
The error mysqlworkbench is showing is "missing 'semicolon'", underlining interview_question_template after the FROM.
The execution error says there is an error on that line after ' '.