Autonumbering a second column

Discussion in 'MySQL' started by popcornmonsters, Jan 21, 2008.

  1. #1
    Hello, everyone, I would like to make a new column on one of my tables and automatically number it from 1 to the end of the list. I have about 130,000 rows, so it would take forever to do it by hand. I already have a primary key for the table so I cannot use the autonumber. I assume I will use a while type statement with x = x + 1, but am not sure of the syntax. It is a mysql database, and I have basic knowledge of mysql. Thanks everyone.
     
    popcornmonsters, Jan 21, 2008 IP
  2. AstarothSolutions

    AstarothSolutions Peon

    Messages:
    2,680
    Likes Received:
    77
    Best Answers:
    0
    Trophy Points:
    0
    #2
    is this for going forward or to backwardly add to the existing data?

    When would the 2 columns have different numbers? why have 2 columns with the same content?
     
    AstarothSolutions, Jan 21, 2008 IP
  3. popcornmonsters

    popcornmonsters Guest

    Messages:
    182
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I would like to add a back and forward link to all my movie pages. The problem is, I have large gaps between some of the movie numbers because I deleted alot of the movies from my database (because of either duplicate, foreign or adult movies). So one movie might be 20,000 and the next movie 21,000. And i do not want to reorder the database, because I will lose my links in google. I wanted to make a new column, call it movie order, and number each movie 1-135,000. That way I can use that number for the moving forward and back.
     
    popcornmonsters, Jan 21, 2008 IP