In same DB > How to copy column from table1 to table2

Sadiq6210

Well-known member
How can I copy (column1 in table1) to (column2 in table2)?

Note that:
1- Both tables are in same database.
2- There is data in both column, so I want to replace all (column2) exist data with (column1) data.

I tried many queries but nothing is working !
 
I believe something this should work. You may also need to include the main ID column from both tables to keep them in sync...

UPDATE Table2 AS table2 SET table2.column2 = (SELECT column1 FROM Table1 AS table1 WHERE table1.mainIDcolumn = table2.mainIDcolumn)

Untested, so I don't know for sure if it will work. ;)
 
Last edited:
Back
Top Bottom