我有1台是这样的:
user
----------------------------------------
id | first_name | last_name | full_name
----------------------------------------
我想写一个触发器,它会在Concat的FIRST_NAME和last_name给FULL_NAME。
我曾尝试以下触发器:
delimiter |
create trigger fullname after insert on user
for each row
begin
update user set full_name=(select concat(first_name,last_name) from user where id=new.id)where id=new.id;
end;
|
这显示了这个错误,同时插入数据的用户表:
#1442 - Can't update table 'user' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.