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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.