I have a table named ticket. I get the data of all tickets from another base and put it in mine with simple Insert.
By clicking a button on my website, I want the user to be able to update the tickets. Basically I would like to do all these points without making too much code :
- The new tickets that are not already in my base will be inserted
- The tickets already inserted which data is not up to date will be updated
- The tickets already inserted which data is up to date will be ignored
By now, I've tried to make a trigger which looks like this:
CREATE TRIGGER before_insert_task BEFORE INSERT
ON ticket FOR EACH ROW
BEGIN
UPDATE ticket
SET technician = NEW.technician,
date = NEW.date,
closeDate = NEW.closeDate,
solution = NEW.solution,
content = NEW.content,
actiontime = NEW.actiontime;
END
This does not work, I saw that you cant make trigger that update before/after insert.