Page 1 of 1
Link two table in MySQL
Posted: Mon May 01, 2006 1:13 pm
by antubis
Hello to all,
I want to link two tables so when I insert information in first table ( when I create row ), a new row is creating in other table.
10x and Regards to all
Posted: Mon May 01, 2006 1:42 pm
by savant
Posted: Tue May 09, 2006 11:26 am
by BadgerC82
I'm not sure it was the article you are after that was posted by savant.
Essentially are you wanting to create a row on a table within the same database? If so why not just use another insert?
Carl
Re: Link two table in MySQL
Posted: Tue May 09, 2006 12:43 pm
by GM
antubis wrote:Hello to all,
I want to link two tables so when I insert information in first table ( when I create row ), a new row is creating in other table.
10x and Regards to all
You need to create a trigger, like:
Code: Select all
CREATE TRIGGER trigger_name AFTER INSERT ON table1
FOR EACH ROW BEGIN
INSERT INTO table2 VALUES (values);
END