0

I want to TRUNCATE some values but I don't want to delete anothers...

I have 3 ids, and the next id will be 14 or something like that... I want that the next id will be 4... How can I do this?


I have one solution but I like other more simple. I can export all the table, truncate it, and later import it. But it's a lot of work. :P

Midhun MP
  • 103,496
  • 31
  • 153
  • 200
Seazoux
  • 621
  • 1
  • 5
  • 28

1 Answers1

3

You can set the next auto_increment value after deleting your records with

ALTER TABLE your_table AUTO_INCREMENT = 4;

SQLFiddle demo

juergen d
  • 201,996
  • 37
  • 293
  • 362