Join DELETE in MySql? How to?
Posted
by Camran
on Stack Overflow
See other posts from Stack Overflow
or by Camran
Published on 2010-04-21T17:38:27Z
Indexed on
2010/04/21
17:53 UTC
Read the original article
Hit count: 296
I have this:
$query="DELETE FROM classified, $sql_table WHERE classified.ad_id = '$id' AND classified.classified_id = $sql_table.classified_id AND classified.poster_password='$pass'";
I get this error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE classified.ad_id = 'Bmw_M3_E46_Full_29920' AND classified.cla' at line 1
Any help?
As you can see the $sql_table is linked to the classifieds table with the fields classified_id
I need to JOIN DELETE somehow.
Basically classified table is the main table, then every category has its own tables with vehicle data. classified table has a field called classified_id which is the same as the
Here is the full query echoed:
DELETE FROM classified, vehicles WHERE classified.ad_id = 'Bmw_M3_E46_410811305' AND classified.classified_id = vehicles.classified_id AND classified.poster_password='some_password'
Why isn't this working, Should it be so hard to delete from multiple tables?
Thanks
© Stack Overflow or respective owner