My database has two tables, the notification and the service, as the image shows.
Inthenotificationtablethedefaultstatusvalueis"open."
I tried to do a trigger that updates the default status "open" to "on-call" after a new call is entered in the attendance table My trigger ended up changing the status of all the records in the notification table, and I want to change only the status of the notification that is referenced in the attendance table.
Below is my trigger code
DELIMITER //
CREATE TRIGGER atualizanotificacao BEFORE INSERT ON atendimento
FOR EACH ROW
BEGIN
UPDATE notificacao SET status = "Em atendimento" WHERE idnotificacao = idnotificacao;
END
// DELIMITER ;