开发者

MySQL INSERT SELECT problem

I have a table with primary key id AUTOINCREMENT and many columns where lang='en' and so if I do:

D开发者_Go百科ELETE FROM ".MY_PRF."form WHERE `lang` <> 'en';

I want to copy all the columns where lang='en' and then changing lang to 'cz' like so:

INSERT INTO form (`lang`, `caption`, `type`) 
  SELECT 'cz', `caption`, `type` 
    FROM form 
    WHERE lang = 'en';

This query produces an error:

Duplicate entry '127' for key 1 

I don't know what's happening because the primary key is AUTOINCREMENT. I just want to duplicate the lang='en' rows changing the lang to 'cz'.


what is the type of ID variable?

If it is TINYINT change it to the INT

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜