38

In SQLite how do I copy data from one column to another in the same database table?

1 Answer 1

64

Try this:

UPDATE tableName SET destinationField = sourceField 
Sign up to request clarification or add additional context in comments.

2 Comments

What if that results in foreign key mismatch - "someOtherTable" referencing "tableName": UPDATE tableName SET destinationField = sourceField? (where someOtherTable references the source field, which we're not touching).
This sql may require where clause, so just add where 1=1 at the end of script!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.