[PHP-DB] auto_increment

2010-09-07 Thread Ron Piggott
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

Re: [PHP-DB] auto_increment

2010-09-07 Thread Adriano Rodrigo Guerreiro Laranjeira
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

Re: [PHP-DB] auto_increment

2010-09-07 Thread Ron Piggott
I am receiving the following error Adriano: SQL query: ALTER TABLE `stats` DROP `visits` CREATE TABLE `stats2` LIKE `stats` ; MySQL said: Documentation #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near

Re: [PHP-DB] auto_increment

2010-09-07 Thread Kapu
You are missing a semicolon after the first alter statement. Kapu On 7. 9. 2010 18:05, Ron Piggott wrote: I am receiving the following error Adriano: SQL query: ALTER TABLE `stats` DROP `visits` CREATE TABLE `stats2` LIKE `stats` ; MySQL said: Documentation #1064 - You have an error in