3 deleted 5 characters in body; edited title
source | link

MySQL - Use a Trigger to compare Comparing dates in a BEFORE INSERT trigger

I need help making a TRIGGER that compares two dates being entered into a table, bybut 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?

MySQL - Use a Trigger to compare dates BEFORE INSERT

I need help making a TRIGGER that compares two dates being entered into a table, by 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?

Comparing dates in a BEFORE INSERT trigger

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?

2 deleted 34 characters in body; edited title
source | link

MySQL - Use a Trigger to compare dates BEFORE INSERT

I need help making a TRIGGERTRIGGER that compares two dates being entered into a table, by 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

Basically, myMy 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.

I'm not sure how toHow do I accomplish this.

Many thanks DA?

MySQL - Use Trigger to compare dates BEFORE INSERT

I need help making a TRIGGER that compares two dates being entered into a table, by 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

Basically, 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.

I'm not sure how to accomplish this.

Many thanks DA

MySQL - Use a Trigger to compare dates BEFORE INSERT

I need help making a TRIGGER that compares two dates being entered into a table, by 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?

1
source | link

MySQL - Use Trigger to compare dates BEFORE INSERT

I need help making a TRIGGER that compares two dates being entered into a table, by 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

Basically, 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.

I'm not sure how to accomplish this.

Many thanks DA