I need to make a trigger in mysql, but I need it to run only when there is an update in the auctions that change the status to 3 or 4.
It is of type AFTER UPDATE
BEGIN
IF (NEW.status IN ('3','4')) THEN
QUERY_AQUI
END IF;
END
I need to make a trigger in mysql, but I need it to run only when there is an update in the auctions that change the status to 3 or 4.
It is of type AFTER UPDATE
BEGIN
IF (NEW.status IN ('3','4')) THEN
QUERY_AQUI
END IF;
END
The logic is correct. Anyway, here's an example code:
The form your code is in was not created trigger
, to create it you need to specify CREATE TRIGGER nome_da_trigger
CREATE TRIGGER minha_trigger
AFTER UPDATE
ON minha_tabela FOR EACH ROW
BEGIN
IF (minha_tabela.status IN ('3','4'))
THEN
QUERY_AQUI
END IF;
END;