denno020 Posted March 16, 2011 Share Posted March 16, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/230785-fixing-row-id-numbering-issue/ Share on other sites More sharing options...
bh Posted March 16, 2011 Share Posted March 16, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/230785-fixing-row-id-numbering-issue/#findComment-1188084 Share on other sites More sharing options...
fenway Posted March 17, 2011 Share Posted March 17, 2011 Don't ever change them -- ever. Quote Link to comment https://forums.phpfreaks.com/topic/230785-fixing-row-id-numbering-issue/#findComment-1188755 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.