jeudi 1 février 2018

MySQL Trigger IF Statement OR not workign when two conditions match

I'm fairly new to MySQL Trigger sintax and I'm having a problem that I could not find a clear answer anywhere.

i have a quite simple IF statment, it enters on the IF, if one OR the other condition is met, but never if both are.

i want to have some action going if one field or other field of the updated table changes, but if i update both fields it does not work.

Keep in mind that this trigger happens AFTER UPDATE of the table here's my code:

BEGIN
    IF NEW.field1 <=> OLD.field1 OR NEW.field2 <=> OLD.field2 THEN
        #action happens here
    END IF;
END

So, if on update BOTH fields 1 and 2 changes, the condition is never met, can anybody shed me some light?

Also, sorry for any misspelling

Aucun commentaire:

Enregistrer un commentaire