Next I am going to attach an image about the database on which I am working to perform the trigger and I begin to tell you
Well, the idea was to create a trigger that, when I put all the data in an order, gave me the subtotal, with the following formula: "Order.subtotal = (travel.price + class.price) * Order.paymen;"
I have tried to do the trigger in several ways, I have been moving between different errors and now I am stuck with the 1242. I think I have to use the keywords NEW and OLD, but I do not know how to put them. Finally I leave you the last trigger I've tried:
CREATE TRIGGER 'pedidos_before_insert' BEFORE INSERT ON 'pedidos' FOR EACH ROW
BEGIN
declare final integer;
declare vprecio integer;
declare cprecio integer;
declare passengers integer;
set @final:= (select subtotal from pedidos);
set @vprecio:= (select precio from viajes);
set @cprecio:= (select precio from clase);
set @pass:= (select pasajeros from pedidos);
SET @final = (@vprecio+@cprecio)*@pass;
END