我想從一個表插入數據到另一個,但他們必須通過使用相同的ID鏈接。從一個表插入數據到另一個MYSQL
我使用下面的代碼:
INSERT INTO table1 (population_total, GDP_current_US, life_expectancy_at_birth)
SELECT population_total, GDP_current_US, life_expectancy_at_birth
FROM table2
WHERE table1.id=table2.country_code
而且我收到以下錯誤:
#1054 - Unknown column 'table1.id' in 'where clause'
我在做什麼錯?
插入不匹配任何東西 - 更新可能 - 所以你可能有兩個想法混合這裏。 – Randy 2013-05-01 20:15:33