I'm new to the php mysql developpement, I want to make a trigger to be launched after I insert a row in the evolution table. The trigger must take a value (prixMisDaccord) from another table (inscription) and reduce it value from the evolution column prixAPaye.
Here is what I tried and what I found on Stack Overflow:
DELIMITER $$
CREATE TRIGGER trg_rap
BEFORE INSERT ON evolution FOR EACH ROW
BEGIN
DECLARE pmd float;
-- Check BookingRequest table
SELECT prixMisDaccord
INTO @pmd
FROM inscription
WHERE inscription.idETD= 1;
SET NEW.resteAPaye = @pmd-NEW.prixPaye
WHERE idETD = 1;
END;
$$
DELIMITER `;