JOINしてDELETEする (Error Code: 1064が出たとき)
今日もGIS関数の話は後回し・・・。
Error Code: 1064
以下のSQLを流したときに出たエラーです。
delete from 子テーブル A1 inner join 親テーブル A0 on A1.キーカラム = A0.キーカラム where 適当な条件
エラー文言は以下のような感じ
Error Code: 1064. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version or the right syntax to use near 'A1…
正しくはこう書きます。
delete A1 from 子テーブル A1 inner join 親テーブル A0 on A1.キーカラム = A0.キーカラム where 適当な条件
(A1のところは別名じゃなくてもいいです)
delete と from の間にテーブル名を入れる という発想がそもそも無かったんよ、MySQL。