I am trying to duplicate a row in my table, into another table. There query looks like this
INSERT INTO `quote_block_arc` (`id`,`quote_id`,`name`,`description`,`price`,`hours`,`days`,`total_hours`,`is_print`,`amends`) SELECT `id`,`quote_id`,`name`,`description`,`price`,`hours`,`days`,`total_hours`,`is_print`,`amends` FROM `quote_block` WHERE `quote_id` = '41'
However, it failing saving there is a duplicate key for this row, is there a way to ignore that warning and run the query?
This error occurs because you have specified one of the columns of your table to be
UNIQUE. You cannot have 2 rows with the same value for this column. If you want to replace the existing row instead, useREPLACEinstead ofINSERT. If you really want rows containing the same value for the column, remove theUNIQUEmodifier from that column.Using
INSERT IGNOREas described in some of the other answers will prevent the error being issued, but will not update the table.