MYSQL table question

Discussion in 'MySQL' started by izlik, May 19, 2008.

  1. #1
    Hello

    Im trying to convert my database table to match another, and now i need to move some of the collumns so the match up. lets say we have 3 collumns CAT CAT1 CAT2 how can i make CAT1 and CAT2 switch places ? if that's even possible
     
    izlik, May 19, 2008 IP
  2. kashem

    kashem Banned

    Messages:
    1,250
    Likes Received:
    76
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I m not getting you fully? Would you explain little more.

    If you want to swap data between cat1 column and cat2 column , the option is
    1. Create another column say cat4
    2. Update cat4 with cat2
    3.Update cate2 with cat1
    4. Update cat1 with cat4
    5. Drop cat4
     
    kashem, May 19, 2008 IP
  3. izlik

    izlik Well-Known Member

    Messages:
    2,399
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    185
    #3
    no not swap data... it's basiclly, when i "export" the table in phpmyadmin it comes out like bellow (2000+ queries all the same)

    what i need is 'f-218' & '12 Holes' to switch places so it's

    otherwise it wont wok with the new database structure and since each querie comes out with "INSERT INTO" it would be a paint in the ass to change for each.
     
    izlik, May 19, 2008 IP
  4. kashem

    kashem Banned

    Messages:
    1,250
    Likes Received:
    76
    Best Answers:
    0
    Trophy Points:
    0
    #4
    The table you are entering data (destination table) is it empty? how many are columns there?

    Here is a solution u can considerto order of desitanation table columns
    Check it here dev.mysql.com/doc/refman/5.0/en/change-column-order.html
     
    kashem, May 19, 2008 IP