can a trigger be created in mysql insert for two tables at a time with inner join?

0

I'm doing a project in PHP and MySql where I'm working the audit part with trigger, I would like to know if it can be done in the same insert trigger for two tables .. append here the code I was testing from phpmyadmin

CREATE TRIGGER Personas_AInsertar AFTER INSERT
FROM personas INNER JOIN usuarios  ON (usuarios.usuarios_cedula=personas.cedula)
FOR EACH ROW 
INSERT INTO bitacorapersonas (Accion,fecha,cedUsuario, nombreUsuario,tipoUsuario,cedula,nombreNuevo,apellidoNuevo,sexoNuevo,telefonoNuevo,direccionNuevo,fnacimientoNuevo,usuarioNuevo,correoNuevo) 
VALUES ('Inserto',NOW(),@identificador,@identificador2,@identificador3,NEW.cedula,NEW.nombres,NEW.apellidos,NEW.sexo,NEW.telefono, NEW.direccion,NEW.fnacimiento, NEW.usuario, NEW.correo)

the data of usuarioNuevo and correoNuevo are in the table usuario and the rest is in the table personas . What I want to know is if in the same query the table bitacoraPersona can leave me the fields adding in a single row and not separated .. the data that was inserted of the person in one line and the user data in another line .. I hope you can help me

Annex two images as they appear

the last 2 actions that appear is from the same person, but the user and mail part as explained are from a trigger different from the trigger of the data of the person, as I do to appear in the same row if it is from a single person?

    
asked by rodrigo2324 17.08.2017 в 01:16
source

0 answers