Fira Posted September 24, 2006 Share Posted September 24, 2006 Is it possible to change the order of the columns in a table? Link to comment https://forums.phpfreaks.com/topic/21824-switching-order-of-columns/ Share on other sites More sharing options...
AndyB Posted September 24, 2006 Share Posted September 24, 2006 Why would you want to do that? It's the order in which you display retrieved data that's important, isn't it? Link to comment https://forums.phpfreaks.com/topic/21824-switching-order-of-columns/#findComment-97455 Share on other sites More sharing options...
Fira Posted September 24, 2006 Author Share Posted September 24, 2006 [quote author=AndyB link=topic=109239.msg440162#msg440162 date=1159060412]Why would you want to do that? It's the order in which you display retrieved data that's important, isn't it?[/quote]Yes, but one of my primary indices "id" is listed as my sixth column. It'd be easier to browse and keep track if I could change the position of "id" to first position. Link to comment https://forums.phpfreaks.com/topic/21824-switching-order-of-columns/#findComment-97488 Share on other sites More sharing options...
shoz Posted September 24, 2006 Share Posted September 24, 2006 I don't know of a way to move the column only. You can use the CHANGE and MODIFY options for "ALTER TABLE" to move it but you'll have to redefine the column.eg:[code]ALTER TABLE tablename MODIFY columnname INT NOT NULL AUTO_INCREMENT FIRSTorALTER TABLE tablename MODIFY columnname INT NOT NULL AUTO_INCREMENT AFTER othercolumn[/code]http://dev.mysql.com/doc/refman/4.1/en/alter-table.htmlBe careful when writing the column definition. If the wrong definition is given you may alter the contents of the column. Link to comment https://forums.phpfreaks.com/topic/21824-switching-order-of-columns/#findComment-97612 Share on other sites More sharing options...
fenway Posted September 25, 2006 Share Posted September 25, 2006 There isn't a way to move a column because it's totally unnecessary. Link to comment https://forums.phpfreaks.com/topic/21824-switching-order-of-columns/#findComment-97940 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.