I have a trigger that does an update on my table. I would like to know how to do so that the trigger is only executed if the status column is different from what is already in my table, if it does not, nothing happens.
DELIMITER $$
CREATE TRIGGER trg_anuencias
AFTER UPDATE ON anuencias
FOR EACH ROW BEGIN
INSERT INTO anuencias_auditoria
SET acao = 'update',
id_anuencia = NEW.id,
status = NEW.status,
modificadoem = NOW(); END$$
DELIMITER ;
Thank you in advance.