MySQL error #1060 - Duplicate column name

I am trying to perform the following command to update a table:

 ALTER TABLE wsnlinks_links ADD movedto int default '0' NOT NULL 

but when I do I get the following error:

#1060 - Duplicate column name 'title' 

I found this thread on a 1060 error

But wasn’t able to figure out how that applied to my situation. I’ve checked the table and as far as I can tell there is only one ‘title’ column, so I can’t figure out what is happening- any ideas?

I’m using MySQL 4.1.9

Thanks.

i don’t know why this would cause this error, but you have your default ‘0’ and NOT NULL backwards. swap them.

Thanks, I swapped it to:

 ALTER TABLE wsnlinks_links ADD lastposterid int NOT NULL default '0' 

and I am still getting the same error. Any other ideas?

please post the complete CREATE TABLE

I’m a newbie and not sure I understand your question- the tables have already been created, shouldn’t I be able to enter the above command as a simply MySQL query?

do you have a utility application like phpmyadmin or mysql-front? these applications are all able to “export” the structure of the table, which means they will produce the CREATE TABLE statement for your table

longneck wants to see the CREATE TABLE statement so that he can create the table on his own system and then test your ALTER statement on it, to see if he can reproduce the error message

Thanks r937, I think I have attached what you need. I exported the structure of the wsnlinks_links table that I think is giving me trouble using phpmyadmin as an sql file, please let me know if you need something different.

Thanks!

the problem is this line: KEY wsnindex (catid,title(5),title(5))

run these two queries:

ALTER TABLE `wsnlinks_links` DROP INDEX `wsnindex`;
ALTER TABLE `wsnlinks_links` ADD INDEX `wsnindex` ( `catid` , `title` ( 5 ) );

how you managed to get your table set up like that to begin with is beyond me!

Thanks so much Longneck- I’m not sure how it got setup that way either, it was an automated table setup, something must have gone wrong. Thanks again.