Click to See Complete Forum and Search --> : re order field structure in mysql


themoon
09-25-2006, 03:11 AM
Hi,
in my table i have:
name,number,date
how can i replace the field "name" with the field "date" so that date will be the first column.
I want to do this without deleting the fields because i have some data.
i know that i can do select statement and order it accordingly.
But is there a way to do it with alter command

thanks

chazzy
09-25-2006, 07:02 AM
why does the order matter though?

mysql does support changing the column order, but i'm not sure why you feel like it is necessary to have the columns in a particular order?

themoon
09-25-2006, 07:13 AM
it is just because someone else asked me how to do that....
i even suggested to make a select statement and order it, but still he persists to know how as he wants to print that page...
thanks

chazzy
09-25-2006, 08:40 AM
straight from the mysql manual...

http://dev.mysql.com/doc/refman/5.0/en/change-column-order.html

themoon
09-26-2006, 06:10 AM
thank you so much