我有2个表,国家和分区与ff架构:
country division
----------- ------------
countrycode divisioncode
contryname countrycode
divisionname
我想将国家/地区表中的数据复制到分区表中,其中国家代码分为分区代码,分区表中的国家代码和分区名称的国家/地区名称
对于前者,美国 - 美国进入美国,美国,美国的分区表。
答案 0 :(得分:3)
<强>查询强>
INSERT INTO division(divisioncode, countrycode, divisionname)
SELECT countrycode, countrycode, countryname
FROM country;
答案 1 :(得分:3)
insert into division (divisioncode, countrycode, divisionname)
select t1.countrycode, t1.countrycode, t1.countryname
from country t1
请参阅:http://dev.mysql.com/doc/refman/5.7/en/insert-select.html