I have a table with primary key id AUTOINCREMENT
and many columns where lang='en'
and so if I do:
DELETE 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'
.