我有一個MySQL數據庫。我想刪除places.match_no > 26
和matches.chart_id = 106
的所有比賽。MySQL刪除內連接,但外鍵約束失敗
DELETE matches
FROM kk_matches AS matches
INNER JOIN places ON places.id = matches.place_id
AND places.match_no > 26
WHERE matches.chart_id = 106
這將導致一個錯誤:
#1451 - Cannot delete or update a parent row: a foreign key constraint fails...
怎麼辦?
子表已'ON DELETE NO ACTION',這就是我想要使用。 – xms