[英]Copy columns data from one table to another
Please could someone help, i'm really stuck. 请有人帮忙,我真的很困。
I have a mysql database with two tables ( with thousands of rows ), each table has a column called 'map' and i need to copy all the rows from one tables column to the 'map' column of the other table? 我有一个带有两个表(具有数千行)的mysql数据库,每个表都有一个名为“ map”的列,我需要将所有行从一个表列复制到另一张表的“ map”列吗?
I know it seems simple but i'm getting in a jumble 我知道这似乎很简单,但我陷入了混乱
Something like this would work. 这样的事情会起作用。
UPDATE table_to
JOIN table_from
<put join here>
SET table_to.map = table_from.map
Or just simply use the next. 或者只是简单地使用下一个。 This will insert all rows from table_from with the value from the map column to table_to's map column.
这会将table_from中的所有行以及map列中的值插入table_to的map列中。
INSERT INTO table_to
(map)
SELECT map FROM table_from
copy data from one table to another in mysql 在mysql中将数据从一个表复制到另一个表
INSERT INTO database1
. INSERT INTO
database1
。 table1
SELECT * FROM database2
. table1
SELECT * FROM database2
。 table2
; table2
;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.