Skip to content

Instantly share code, notes, and snippets.

@akagaeng
Created November 24, 2022 10:13
Show Gist options
  • Save akagaeng/7b73b465265ccd6741c545449a7226a4 to your computer and use it in GitHub Desktop.
Save akagaeng/7b73b465265ccd6741c545449a7226a4 to your computer and use it in GitHub Desktop.
Insert seq same as auto_increment id value
START TRANSACTION;

insert into tasks (seq)
values (null);

update tasks
set seq = LAST_INSERT_ID()
where id = LAST_INSERT_ID();

COMMIT;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment