Jump to content

Recommended Posts

I was wondering how I could consolidate the row id's in my tables?

 

In some tables, I have row id's that go 1, 2, 3, etc, but then jump from say 7 to 10, and then to 14 etc.. This is due to deleting rows that were in between before.. Is there a way I can consolidate these rows so that they're all back in order from 1 to however many there are..

 

Thanks

Denno

Link to comment
https://forums.phpfreaks.com/topic/230785-fixing-row-id-numbering-issue/
Share on other sites

Hi,

 

I guess your id column is an auto_increment col. So what you said its true, if you delete a row than the auto_inc value of the table doesnt change. But! its not a good idea to change those "gapped" ids - cuz maybe theres a reference to it. If your foreign keys are perfect (means CASCADES...) and theres everywhere, then you wont get error, but only this point, i think.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.