我尝试使用下面的代码删除船表,并在另一个表相关的资格了“船”:删除在PHP/MySQL的两个表的记录
DELETE FROM tbl_boat, tbl_qualifications
WHERE tbl_boat.BT_ID = '$bt_id' AND tbl_boat.BT_ID = tbl_qualifications.BT_ID;
的问题是我收到以下错误:
1064 - 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 tbl_boat.BT_ID = 113 AND tbl_boat.BT_ID = tbl_
' at line 2 .
感谢此任何帮助。
可能是你可以通过这个得到的想法。 http://stackoverflow.com/questions/1339851/delete-rows-from-two-tables-in-one-query –
你肯定这是否行得通呢? '... WHERE tbl_boat.BT_ID = '$ bt_id' AND tbl_boat.BT_ID = tbl_qualifications.BT_ID':这将只返回的'$ bt_id'和行'tbl_qualifications.BT_ID'是相同的... – Spontifixus