Error Code: 1442. Can't update table 'pedidos' in stored function/trigger

Viewed 18
delimiter //
create trigger calcularSubtotal
after update on detalle_pedido for each row
begin
declare total int;
set total= (select sum(SubTotal) from   pedidos  join detalle_pedido  on  Pedido=ID_Pedido  where ID_Pedido=new.Pedido and ID_Pedido=ID_Pedido);
update Pedidos
set Total = total where ID_Pedido=ID_Pedido and ID_Pedido=new.Pedido ;
end// 
0 Answers
Related