tags:

views:

44

answers:

2

I am using two tables.
User table contains the firstname and lastname field and contactinfo is another table contain the field called 'Name' with usertable Id.I want to make a trigger whenever the User tables firstname or lastname is updated I want change this contactinfo's Name to whatever they changed in the User table.Is it possible through trigger?Please give me some ideason this?

+2  A: 

The general syntax of CREATE TRIGGER is :

    CREATE TRIGGER trigger_name trigger_time trigger_event ON tbl_name 
FOR EACH ROW trigger_statement

Take a look at examples at http://www.roseindia.net/mysql/mysql5/triggers.shtml and http://dev.mysql.com/doc/refman/5.1/en/create-trigger.html

Adnan
+1  A: 

Yes this is possible with a trigger. Actually a trigger is specially used for this!

Here is a link to a page which might be helpfull.

Emerion