mysql - How can I write a trigger that can copy new row from a table on insertion to another table? -
i have 2 tables, creds , users.
users
email password fullname contact city
creds
email password
i need trigger can copy email
, password
users
creds
upon insertion of new rows.
hope following trigger works you. more or less this
create trigger user_trigger on creds insert begin insert users(email, password, fullname, contact, city) select distinct u.email, u.password inserteduser u left join creds c on u.email = c.email , u.password = c.password end;
Comments
Post a Comment