我想删除表格中的所有数据(主题和hits_counter),table1中的topic_id col =表2中的post_topic col,我不知道问题出在哪里。
代码:
$stmt = $con->prepare("DELETE FROM topics INNER JOIN hits_counter ON
topics.topic_id = hits_counter.post_topic WHERE topics.topic_id = ?");
$stmt->bind_param("i", $id);
$stmt->execute();
答案 0 :(得分:2)
如果声明
中有多个表,则需要提及要删除的表DELETE hits_counter, topics
FROM topics
INNER JOIN hits_counter ON ...