如何将下面的这些触发器保存到一个触发器中?如何设置mysql多触发器
我试过了,但我不确定我在做什么错误?
下面是我触发的
create trigger Disminuir_Existencia1 after insert on detalle for each row update producto set existencia = existencia-new.Cantidad where id_p=new.id_p
create trigger Aumentar_Existencia after insert on detalle for each row update producto set existencia =if(new.activo = 0, producto.existencia + new.cantidad,producto.existencia) where new.id_P = producto.id_P
CREATE TRIGGER aumentar AFTER insert on detalle for each row update factura set total = ( select producto.precio * new.cantidad from producto where new.id_p=producto.id_p) where new.Folio= factura.folio;