在项目中,有一张表,需要在用户在插入一条记录时,同时更新字段other_id,要求other_id的值为刚插入的记录的id(id为自增字段),请问怎么写sql啊?
我的思路如下:
表:
create table a (id int not null,nvarchar(20),other_id int);
触发器:
create trigger  changeField_trigger after insert
    on a
    for each row
    begin 
      update a set other_id=:new.id where id=:new.id;
    end;
但是插入数据时会报错!请问高手怎么解决啊?急。等着用啦!!