I want to create a trigger that only inserts into table when the condition is met. I\'ve tried using various combinations of IF/BEGIN/END and WHERE, but Django returns me an SQ
Another easy way to do this.
You should add any symbols between ;
delimiters for the appropriate converting MySQL syntax to the raw SQL.
CREATE TRIGGER trigger_name BEFORE INSERT ON table
FOR EACH ROW
BEGIN
IF NEW.number <> 'anynumber' AND NEW.number <> 'anynumber'
THEN
SET NEW.number = 'anynumber'; --
END IF; --
END
This example works due to the dash symbols.