2016-05-12 113 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

相關問題