Updating Primary auto increment table.
How can I reset an autoincrement database table to rebuild it's numbers?
Here's the scenario: I have a database table with 118 rows. Due to testing the first 82 rows are gone. So I want to reset the autoincrement field for all rows - 82 so row 83 is numbered 1, 84 = 2, 85 = 3 and so on.
I tried UPDATE autoincrement SET autoincrement = (autoincrement - 82) but that doesn't seem to work. I'm guessing maybe because the autoincrement field is the primary key for the database.
I know I could change these all manually... but can't it be done with one simple query?
Thanks
|