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. 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? 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. 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. 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? 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. 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. 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
Archived
This topic is now archived and is closed to further replies.