自動インクリメント列 ID があり、状況によっては、他の列を主キー + 1 値に等しくしたい
ID | other
1 | 2
2 | 3
3 | 4
4 | 123 (some situation, it is not always plus 1)
どうすればこれを達成できますか?
これが私が試したことです
INSERT INTO table (`ID`,`other`) VALUES ('',(SELECT MAX(ID)+1 FROM table))
しかし、それはエラーを返します
You can't specify target table 'table' for update in FROM clause