我继续收到错误消息“缺少关键字”

时间:2016-11-29 13:52:54

标签: mysql sql

我不断收到错误消息“缺少关键字”。我不知道它是什么我错过了,有人可以帮忙吗?

这是我的代码

create trigger EmployeeforUpdate
after insert
on Employee
for insert, delete, Update
declare
  staff_id;
begin
insert into payroll
(first_name, middle_name, surname, department, designation, Grade_level,step)
select (first_name, middle_name, surname, department, designation, Grade_level,step)
from employee
End
/

1 个答案:

答案 0 :(得分:0)

CREATE TRIGGER EmployeeforUpdate AFTER INSERT
on Employee
FOR EACH ROW 
BEGIN
DECLARE staff_id VARCHAR(50);
INSERT INTO payroll(first_name, middle_name, surname, department, designation,Grade_level,step)
SELECT first_name, middle_name, surname, department, designation,Grade_level,step FROM employee
End;

有关插入选择的更多信息:http://www.w3schools.com/sql/sql_insert_into_select.asp