create trigger update_t1
after update on t1 for each row
begin
select count(*) from t2 where id=New.id into @num;
if @num=0 then
/*insert into t2; */
else
/*update t2 */
end if;
end;
用于插入操作
create trigger insert_t1
after insert on t1 for each row
begin
/*insert into t2; */
end;
1条答案
按热度按时间toe950271#
为不同的操作创建两个触发器
用于更新操作
用于插入操作