Отрабатывает только последний case, а пертые 2 нет. Уже всею голову сломал. Помогите пожалуйста.
DROP TRIGGER IF EXISTS queue_log;
DELIMITER $$
CREATE TRIGGER `queue_log` AFTER insert ON `queue_log`
FOR EACH ROW BEGIN
CASE WHEN queue_log.`event` = 'COMPLETEAGENT' THEN UPDATE calls SET calls.laststep = 'answered' WHERE calls.uniqueid = NEW.callid;
END CASE;
CASE WHEN queue_log.`event` = 'COMPLETECALLER' THEN UPDATE calls SET calls.laststep = 'answered' WHERE calls.uniqueid = NEW.callid;
END CASE;
CASE WHEN queue_log.`event` = 'RINGNOANSWER' THEN DELETE FROM queue_log WHERE queue_log.callid = NEW.callid;
END CASE;
END$$
DELIMITER ;