Trying to create a MYSQL if else query with trigger where the temperature gets recorded on another table

16 Views Asked by At

I've been trying to implement this query where if someone inserts temperature above 37.5 it will get recorded to another table automatically through a trigger. But I've been getting errors with this one. Here checkpoint and TableB are two tables.

    AFTER INSERT ON checkpoint
    FOR EACH ROW BEGIN

    IF (checkpoint.temperature>"37.5")
    THEN
      UPDATE TableB
      SET temp2 = NEW.checkpoint_temperature,
      WHERE ID = NEW.ID,
    END IF;
END; 
0

There are 0 best solutions below