Question

What is the easiest way to copy the all the values from a column in a table to another column in the same table?

Was it helpful?

Solution

With a single statement (if the columns have the same datatype)

UPDATE <tablename>
SET <destination column name> = <source column name>

OTHER TIPS

This script will update ALL values in the field1 with the values from the field2 in the corresponding row

UPDATE table SET field1 = field2
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top