Skip to content
Advertisement

MySQl Query: copy a column named ‘C’ from table2 to column ‘C’ in table1 without losing any other column data

I have 2 tables table1 and table2. I have to copy a column named ‘C’ from table2 to column ‘C’ in table1 without losing any other column data. Both field data types are same. Can anybody give me a proper query how to do it.

Advertisement

Answer

Assuming the Table1 already contains the C column and you can Join by id:

source: http://blog.ookamikun.com/2008/03/mysql-update-with-join.html

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement