You are here: Help with multiple table delete « All PHP « IT news, forums, messages
Help with multiple table delete

Posted by kenoli on 01/24/07 22:13

I have 4 tables (Let's say: t1, t2, t3, t4). One has a person_id
column as a native key and the others have a person_id column as a
foreign key.

Periodically, I want to remove all records in all tables with a given
person_id value. The MYSQL manual seems to say I should enter the
tables twice like this:

DELETE t1 t2 t3 t4 FROM t1 t2 t3 t4 WHERE . . . (which makes no sense
to me)

Then I'm not sure how to indicate the person_id value for all tables.
I'd like to just do:

DELETE t1 t2 t3 t4 FROM t1 t2 t3 t4 WHERE person_id = '69'

But this doesn't work. Do I need to do something like:

DELETE t1 t2 t3 t4 FROM t1 t2 t3 t4 WHERE t1.person_id = '69' AND
t2.person_id = '69' etc.

At any rate, I've tried various combinations here and haven't found
anything that works.

Please help!

--Kenoli

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация