Cyto Posted November 5, 2010 Share Posted November 5, 2010 Hey, Can i clear up a row from 1 till last one to get ordered. Because its now like: 1 3 7 10 15 18, want to have 1 2 3 4 5 6 instead. I hope you get it. Cheers. Quote Link to comment https://forums.phpfreaks.com/topic/217806-mysql-clear-up-id-numbers-order/ Share on other sites More sharing options...
Pikachu2000 Posted November 5, 2010 Share Posted November 5, 2010 Why? Quote Link to comment https://forums.phpfreaks.com/topic/217806-mysql-clear-up-id-numbers-order/#findComment-1130517 Share on other sites More sharing options...
Cyto Posted November 5, 2010 Author Share Posted November 5, 2010 So that the auto increment will go in order. Quote Link to comment https://forums.phpfreaks.com/topic/217806-mysql-clear-up-id-numbers-order/#findComment-1130522 Share on other sites More sharing options...
Pikachu2000 Posted November 5, 2010 Share Posted November 5, 2010 That truly isn't a good idea if you want to ensure that you maintain the referential integrity of the database. Quote Link to comment https://forums.phpfreaks.com/topic/217806-mysql-clear-up-id-numbers-order/#findComment-1130535 Share on other sites More sharing options...
Cyto Posted November 5, 2010 Author Share Posted November 5, 2010 Can it be done? Quote Link to comment https://forums.phpfreaks.com/topic/217806-mysql-clear-up-id-numbers-order/#findComment-1130700 Share on other sites More sharing options...
PFMaBiSmAd Posted November 5, 2010 Share Posted November 5, 2010 You generally would need to export your data, truncate the table, and re-import the data. The reason there is not a built-in function to do this is because once you assign identifiers to data, changing those values will causes problems in MOST real applications. It also requires a large amount of processing that makes it impractical in real applications that must remain functional at all times. The database does not care if there are gaps and you should not care either. If gaps are an actual problem in what you are doing, that is an indication that you are using identifiers incorrectly in your application. Quote Link to comment https://forums.phpfreaks.com/topic/217806-mysql-clear-up-id-numbers-order/#findComment-1130713 Share on other sites More sharing options...
Cyto Posted November 5, 2010 Author Share Posted November 5, 2010 Ok thx. Quote Link to comment https://forums.phpfreaks.com/topic/217806-mysql-clear-up-id-numbers-order/#findComment-1130724 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.