Hi,
I’ve 4 tables from which i need to delete rows. Below are the tables:
Table s
Table a
Table v
Table p
Column a_sid of table “a” references column s_id of table “s” where s_id is primary key so as a_sid.
Column v_sid of table “v” references column s_id of table “s”
Column p_sid of table “p” references column s_id of table “s”
I need to delete all rows of 4 tables where a_type of “a” table = “AC”
Please help.
Thanks,
Ramki
From the manual :
DELETE t1, t2, t3 FROM t1 INNER JOIN t2 INNER JOIN t3
WHERE t1.id=t2.id
AND t1.id=t3.id
You just need to change it a bit and adapt it to your situation
r937
November 30, 2010, 8:23am
4
eeeeeeeeewwwwwwwwwwwwww!!! :mad: :mad: :mad:
i didn’t believe it until looked it up, and that is indeed what it says
please, let’s not ever show anyone that particular example again
instead, let’s show them this –
DELETE t1, t2, t3
FROM t1
INNER
JOIN t2
[COLOR="Blue"][B]ON[/B][/COLOR] t2.id = t1.id
INNER
JOIN t3
[COLOR="Blue"][B]ON[/B][/COLOR] t3.id = t1.id
thank you
r937:
eeeeeeeeewwwwwwwwwwwwww!!! :mad: :mad: :mad:
i didn’t believe it until looked it up, and that is indeed what it says
please, let’s not ever show anyone that particular example again
You know, I had some doubts, so I read it twice and looked at the whole page in search of some ‘ON’ clause, but there wasn’t, so I assumed in the case of multiple table deletes the MySQL syntax was different…
I’m glad you confirm my doubts