G
G
gudvin952015-08-03 13:32:09
MySQL
gudvin95, 2015-08-03 13:32:09

How to duplicate a record in a table?

You need to duplicate records in one table. The table has a PRIMARY KEY(CODE) field.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dmitry Kovalsky, 2015-08-03
@dmitryKovalskiy

I don't know why you would. But you can add another key field sequence or something like that

A
Alexey Skahin, 2015-08-04
@pihel

You need to change the primary key of the table to a surrogate key in sequence.
Then there will be no restrictions on entries.

D
Dmitry Kim, 2015-08-19
@kimono

INSERT INTO `tbl` (`col1`,`col2`...`colN`) SELECT `col1`,`col2`,...`colN` FROM `tbl` WHERE `code` = 123

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question