Re: auto_increment

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxx> 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


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux