I need help making a TRIGGER
that compares two dates being entered into a table, but I'm not 100% on the syntax I should use.
Something like:
CREATE TRIGGER chk_dates
BEFORE INSERT ON `job_history`
FOR EACH ROW
BEGIN
IF( NEW.end_date < OLD.start_date ) .../// error, don't insert data
ELSE .../// allow the data to be entered
My table job_history
will have a start_date
, and when end_date
is entered, I want it to check to ensure that it isn't prior to start_date
.
How do I accomplish this?