0

I have a table with a primary key used as a foreign key in another table, now when I delete the entry the primary keys do not stay in order and I want to reorder them and also want to maintain integrity of foreign key

1
  • In what way it is even related to wordpress? please edit your question and include all wordpress relevant information Aug 25, 2016 at 6:53

1 Answer 1

0

ALTER TABLE tablename AUTO_INCREMENT = 1

Change 1 to your desired value. for that case prior to execution of this you can sort your table with the primary field and get the highest value.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.