Jump to content

Archived

This topic is now archived and is closed to further replies.

Fira

Switching order of columns?

Recommended Posts

Why would you want to do that?  It's the order in which you display retrieved data that's important, isn't it?

Share this post


Link to post
Share on other sites
[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.

Share this post


Link to post
Share on other sites
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 FIRST

or

ALTER TABLE tablename MODIFY columnname INT NOT NULL AUTO_INCREMENT AFTER othercolumn
[/code]

http://dev.mysql.com/doc/refman/4.1/en/alter-table.html

Be careful when writing the column definition. If the wrong definition is given you may alter the contents of the column.

Share this post


Link to post
Share on other sites
There isn't a way to move a column because it's totally unnecessary.

Share this post


Link to post
Share on other sites

×

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.