0

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
4
  • 1
    What is <=>? Use <> instead. Commented Aug 28, 2017 at 16:40
  • 1
    Try: db-fiddle. Commented Aug 28, 2017 at 16:45
  • @AnkitBajpai That did it! Thank you so much. I knew it would be something stupid and simple like that... Want to post as an answer? Commented Aug 28, 2017 at 16:50
  • @Aldentec Done. Commented Aug 28, 2017 at 16:54

1 Answer 1

1

What is <=>? Use <> instead.

Sign up to request clarification or add additional context in comments.

2 Comments

That did it! Thank you.
<=> NULL-safe equal to operator.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.