What is the easiest way to copy the all the values from a column in a table to another column in the same table?
Asked
Active
Viewed 3.3k times
2 Answers
50
With a single statement (if the columns have the same datatype)
UPDATE <tablename>
SET <destination column name> = <source column name>

Panagiotis Korros
- 10,840
- 12
- 41
- 43
-
Is this supposed to create the new column ? – yucer Apr 07 '16 at 09:50
-
NOTE: You need to have the destination column already created. – TTS Dec 03 '19 at 23:44
15
This script will update ALL values in the field1 with the values from the field2 in the corresponding row
UPDATE table SET field1 = field2

Ilya Kochetov
- 17,988
- 6
- 44
- 60