I have a field called IntQID, which is an id for each post that is recorded in the SQL database. If a post is 1533, the next entery will be 1534,1535, etc...
I recently messed up and inserted a manual entry with an开发者_开发知识库 ID of 4000. Now the counter has been using that as the last entry, so now new posted are 4001, 4002, 4003.
How do I change the counter to go back to using the next in line after 1533?
Hope this makes sense. Thanks!
To set the auto_increment value to 1533, use:
ALTER TABLE tbl AUTO_INCREMENT = 1533;
To my knowledge, you can't get the highest existing value for setting it in the ALTER TABLE
statement without using two queries minimum.
ALTER TABLE tbl AUTO_INCREMENT = 1000;
精彩评论