我有 1 个这样的表:
user
----------------------------------------
id | first_name | last_name | full_name
----------------------------------------
我想编写一个触发器,它将 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.