Re: auto_increment

From: Date: Tue, 07 Sep 2010 13:56:17 +0000
Subject: Re: auto_increment
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-47369@lists.php.net to get a copy of this message
Hey friend! I can't see another way to fix your table without a processing (like a stored procedure, script, etcetera). But I believe there is a workaround, which involves a creation of another table. See this: mysql> CREATE TABLE stats2 LIKE stats; mysql> ALTER TABLE stats2 ADD COLUMN id INT NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY(id); mysql> INSERT INTO stats2 SELECT *, 0 FROM stats ORDER BY initial_access; Don't forget to see the correct type of INT which should be used. Cheers, Adriano!
On Tue, 7 Sep 2010 05:29:07 -0400 "Ron Piggott" <ron.piggott@actsministries.org> wrote: I am wondering if something like the following will work in mySQL: ALTER TABLE stats ADD visits INT( 25 ) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST ORDER BY initial_access ASC This particular syntax won't work though. initial_access is a column that contains a unix timestamp. I am trying to get the auto_increment value to be added in order of sequence of when the visits occurred. Thank you. Ron


« previous php.db (#47369) next »