Do it this way:

Create Table copy ( sessionid int not null auto_increment,
    username varchar(20 not null,
    start int not null,
    stop int not null,
    ipaddress varchar(15),
Primary Key (sessionid),
Index altkey (username, start, stop)
);

Insert Into copy
Select NULL, username, start, stop, ipaddress
>From youroriginaltablename;

..chris

----- Original Message ----- 
Jaime Teng wrote:

> Hi,
> 
> I have a mysql table:
> +-----------+------------------+------+-----+
> | Field     | Type             | Null | Key |
> +-----------+------------------+------+-----+
> | sessionid | int(10) unsigned |      | PRI |
> | username  | char(20)         |      | MUL |
> | start     | int(10) unsigned |      | MUL |
> | stop      | int(10) unsigned |      | MUL |
> | ipaddress | char(15)         | YES  |     |
> +-----------+------------------+------+-----+
> 
> sessionid is a unique key.
> 
> Is there a way to change the values of sessionid such that
> the values will be numbered from 1 and increments by 1?
> 
> ie, if the numbers were "1,20,22,25,40,45,47....."
> the new data will be "1,2,3,4,5,6,7,8,9....." ?



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to