|
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]
|