rcouser Posted February 3, 2009 Share Posted February 3, 2009 Hello i am trying to delete from two table with the following query DELETE FROM product_items JOIN cables_specification ON ( product_items.product_item_id = cables_specification.product_item_id ) WHERE product_items.product_item_id = 1 But I just 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 '* FROM product_items JOIN cables_specification ON ( product_items.product' at line 1 Weird because i can use SELECT * FROM product_items JOIN cables_specification ON ( product_items.product_item_id = cables_specification.product_item_id ) WHERE product_items.product_item_id = 1 Link to comment https://forums.phpfreaks.com/topic/143698-deleting-two-mysql-table-with-php/ Share on other sites More sharing options...
flyhoney Posted February 3, 2009 Share Posted February 3, 2009 You cannot do a join in a DELETE statement. You will need to do 2 separate deletes. DELETE FROM product_items WHERE product_items.product_item_id = 1 DELETE FROM cables_specification WHERE cables_specification.product_item_id = 1 Link to comment https://forums.phpfreaks.com/topic/143698-deleting-two-mysql-table-with-php/#findComment-753970 Share on other sites More sharing options...
rcouser Posted February 4, 2009 Author Share Posted February 4, 2009 Thanks flyhoney got it sorted, I think the ability to delete like that should be added at the next version of sql Cheers Link to comment https://forums.phpfreaks.com/topic/143698-deleting-two-mysql-table-with-php/#findComment-754359 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.