My table has two keys, one is an auto incrementing id (PRIMARY), the other is the name of the item (UNIQUE).
Is it possible to duplicate a row within this same table? I have tried:
INSERT INTO items
SELECT * FROM items WHERE id = '9198'
This gives the error Duplicate entry '9198' for key 'PRIMARY'
I have also tried:
INSERT INTO items
SELECT * FROM items WHERE id = '9198'
ON DUPLICATE KEY UPDATE id=id+1
Which gives the error Column 'id' in field list is ambiguous
And as far as the item name (UNIQUE) field goes, is there a way to append (Copy) to the item name, since this field must also be unique?
Select all columns explicitly, except the id column:
Your next question will probably be:
Answer: No, I don’t think so.