1

How do I make this sqlite trigger compatible with MYSQL, I have never used triggers with MYSQL and I'm confused.

             CREATE TRIGGER IF NOT EXISTS update_this AFTER INSERT ON this
             BEGIN
             UPDATE `another` SET `something` = `something` + new.number;
             END;

Solution :

     delimiter |
     CREATE TRIGGER update_this AFTER INSERT ON this`
     FOR EACH ROW BEGIN
     UPDATE `another` SET `something` = `something` + NEW.something WHERE `id`= NEW.id;
     END;
     |    
     delimiter ;
1

1 Answer 1

1

Unverified:

delimiter //
    CREATE TRIGGER update_this AFTER INSERT ON your_table
    BEGIN
        UPDATE `another` SET `something` = `something` + new.number;
    END;
//
Sign up to request clarification or add additional context in comments.

1 Comment

I played around with it and found a solution, thanks everyone for trying

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.