how can I make a trigger for 2 tables?

0

I'm thinking about making triggers that save when there is insert in 2 tables, I mean

I have this table:

--- tbl_cliente ---
Cod_Cli mail
password
First name
Surname
age
birth date

and I have this other table

--- tbl_administrator ---
Cod_Admin mail
password
employee_code


Where I want to rescue only the fields: Cod_Cli, Cod_Admin, mail2, passwordx2 ( x2 = because it is repeated in both tables )


this would be the trigger table

--- tbl_trigger ---
Cod_User
Email
Password
Fech_Registro

Where both the client and administrator codes would be saved in Cod_User , Mail and Password the email / password fields and finally Fech_Registro I have declared DATETIME type so that when there is an insert the exact moment of the registration is taken

I tried to create in the table tbl_trigger 2 TRIGGERS 1 for client and another for administrator, that could be the solution but I can not say if it is optimal ... besides I just want to copy those specific fields when there is an insert in one of the 2 tables, which is why I ask for help since I do not know how to define to mysql which fields it should specifically store in both tables.

Thanks in advance for the Help: D

    
asked by 09.10.2018 в 16:59
source

0 answers