Jump to content

Switching order of columns?


Fira

Recommended Posts

[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.
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.

Archived

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

×
×
  • Create New...

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.