I think the best way is to modify the FOREIGN KEY definition in the tables 1 
and 2 adding the 'ON DELETE CASCADE' condition.

ALTER TABLE 1 ADD FOREIGN KEY (fkCol) references 2(pkCol) on DELETE CASCADE;

ALTER TABLE 2 ADD FOREIGN KEY (fkCol) references 3(pkCol) on DELETE CASCADE;



Aloha!

Claudio Nanni



-----Messaggio originale-----
Da: Chandra N [mailto:[EMAIL PROTECTED] 
Inviato: martedì 17 giugno 2008 9.44
A: mysql@lists.mysql.com
Oggetto: delete a data from 3 tables

hi,
 
I would like to know how to delete a data from 3 table which is interconnected 
with each other by foreign key.
i.e 1st table is connected with 2nd table by foreign key and 2nd table is 
connected with 3rd table with foreign key.
please help to solve this problem.
 
Thanks 
chandra
 


      

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to