mysql duplicate field value

1

The fact is that I want two specific fields of different tables and with different names to have the same value continuously, without having to do querys, that is, as if one were the image of the other. Could I do it?

    
asked by Quarkbite 22.01.2018 в 10:25
source

1 answer

2

Maybe you can try a trigger ...

CREATE TRIGGER nombredeldisparador AFTER UPDATE ON tabla1 FOR EACH ROW

BEGIN

UPDATE tabla2 SET campodelatabla2 = tabla1.campodelatabla1 WHERE iddelatabla2 = tabla1.iddelatabla1; (con el id o con la relación que haya entre esas dos tablas...)

END
    
answered by 22.01.2018 / 12:16
source