4
My database has two tables, notification and attendance, as shown in the image.
In the notification table the default value of the status is "open".
I tried to make a Rigger that updates the default status "open" to "in attendance" after a new attendance table is inserted My Rigger ended up changing the status of all 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 the code of my Rigger
DELIMITER //
CREATE TRIGGER atualizanotificacao BEFORE INSERT ON atendimento
FOR EACH ROW
BEGIN
UPDATE notificacao SET status = "Em atendimento" WHERE idnotificacao = idnotificacao;
END
// DELIMITER ;
That’s right! Thank you very much :)
– Leonardo