doriansm
doriansm

Reputation: 245

MySQL AFTER UPDATE Trigger Not Firing

I am trying to set-up a trigger that will essentially archive information based on when a certain column is updated. What this should be doing is moving schedule_id and login from the schedule table to the schedule_archive table every time the term_date_schedule column is changed. However, that isn't happening. I am extremely new to MySQL, so I am probably missing something obvious.

CREATE DEFINER=`user`@`%` TRIGGER employee_term 
AFTER UPDATE ON schedule
FOR EACH ROW
BEGIN
    IF NEW.term_date_schedule <=> OLD.term_date_schedule THEN
        INSERT INTO schedule_archive(schedule_id, login) VALUES(old.schedule_id, old.login);
END IF;
END

Upvotes: 0

Views: 170

Answers (1)

Ankit Bajpai
Ankit Bajpai

Reputation: 13519

What is <=>? Use <> instead.

Upvotes: 1

Related Questions