0
I have a Rigger, whenever a value is added to the table in mysql I take the old value(OLD) and add to another table, but I would like to improve this by adding the values to the same table but without duplicating, because I have 3 columns, ID, FIRST NAME, LAST NAME, if I do this the ID will be duplicated, there is some way to make the ID for example, ID+999?
DELIMITER //
CREATE TRIGGER working
BEFORE UPDATE
ON name FOR EACH ROW
BEGIN
INSERT INTO name
( id,
name,
adress)
VALUES
( OLD.id+9999,
OLD.name
OLD.adress);
END; //
DELIMITER ;
I recommend that you put some code as you are doing or explain with some print what you want to do... Stack Overflow is not for this kind of doubt
– Angelo Soares
I added Trigger’s code to make it better
– Fake
I see no justification for such a procedure. Rethink your problem and analyze the best solution for it that does not seem to me, honestly, to be this.
– anonimo