2016-05-12 79 views
1

我有2个表,国家和部门与FF模式:如何将数据从一张表复制到另一张表中?

country    division 
-----------   ------------ 
countrycode   divisioncode 
contryname   countrycode 
         divisionname 

我想将数据从国表复制到其中COUNTRYCODE进入在分割表divisioncode和COUNTRYCODE和COUNTRYNAME进入divisionname分配表

例如,美国 - 美国进入美国,美国和美国的分区表。

+1

插入到T2(C1,C2,...)选择X1,X2,...从t1 – jarlh

回答

3

使用INSERT INTO ... SELECT

查询

INSERT INTO division(divisioncode, countrycode, divisionname) 
SELECT countrycode, countrycode, countryname 
FROM country; 
+0

谢谢。我修改了一下'INSERT INTO除法(divisioncode,countrycode,divisionname) SELECT countrycode,countrycode,countryname FROM country;' – dats

相关问题