Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
データベースに新しい行を作成するとき、列 ' identifier' と、挿入時に自動インクリメントされた ' ' と同じ値を取る必要がprimary key auto-incrementある別の列 ' ' があります。私が知っている唯一の解決策は、最後に挿入された行を使用して更新することです。挿入中に両方の列を更新することはできますか?originalIdentifieridentifierlastInsertedId
identifier
primary key auto-increment
originalIdentifier
lastInsertedId
トリガー ( ) の助けを借りて、挿入操作後にの値で列AFTER INSERTを更新できます。originalIdentifieridentifier
AFTER INSERT