Tengo 2 campos datetime: startDateTime y endDateTime ... Quiero que cuando ingreso una startDateTime mayor que endDateTime, la endDateTime tome el valor de startDateTime.
He intentado sin resultados:
CREATE TRIGGER validate_start_or_end_dateTime_before_update_user<br>
BEFORE UPDATE ON users<br>
WHEN OLD.startDateTime<>NEW.startDateTime OR OLD.endDateTime<>NEW.endDateTime<br>
BEGIN<br>
SELECT<br>
CASE<br>
WHEN NEW.startDateTime<>OLD.startDateTime AND NEW.startDateTime>OLD.endDateTime THEN<br>
OLD.endDateTime=NEW.startDateTime<br>
WHEN NEW.endDateTime<>OLD.endDateTime AND NEW.startDateTime>OLD.endDateTime THEN<br>
OLD.startDateTime=NEW.endDateTime<br>
END;<br>
END;<br>