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.
ヘルプ mysql で max(id) または前の id または行数を使用せずに sql を使用してデータベース テーブルの auto_increment 値を取得する方法
LAST_INSERT_ID() DOCSを使用して、最後に生成された ID を取得します。
列「ID」を持つテーブル「Student」を考えます (ID は自動インクリメント)。
select Id from Student order by Id desc LIMIT 1