PDA

View Full Version : [mySQL] delete from multiple tables



ahmed
August 24th, 2003, 07:21 PM
I'm trying to delete records from two tables (in the same db).. my query statement is structured like this:

delete from table_1 where id='7'; delete from table_2 where id='7'; Now, if I copy and paste that into phpmyadmin, it perfectly works. When it's part of my script it doesn't work, however :(

Anyone got a clue how to fix this? :)

Jubba
August 24th, 2003, 10:19 PM
http://forums.devshed.com/t55986/s.html

I don't think its possible in one statement...

ahmed
August 24th, 2003, 11:28 PM
ah.. no worries then.. thanks for the link :)

eyezberg
August 25th, 2003, 05:20 PM
what happens if you do
delete from table_1,table_2 where id='7'; ?
or if you use a "join"..

ahmed
August 25th, 2003, 05:31 PM
i didn't try using the two tables with a comma separating them.. that might work :)

As for a join, I've read on another forum that you can perform a join for deletion :)