我使用3個表格來插入第4個表格的數據。 我的表:爲什麼只插入一行?
Typology
id_typo------PK
name_typology----
Country
id_country---PK
name_country---
Brut
id_brut------PK
name_typology--
name_country---
Structure
id_struct---PK
id_typo-----fk
id_country---fk
我想從表香檳數據transfert表結構。 問題是插入了一行。爲什麼?
我的要求:
INSERT INTO structure (id_struct,id_typo,id_country)
SELECT x.id_struct,y.id_typo, z.id_country,
FROM brut AS x, typology AS y, country AS z
WHERE x.name_typology = y.name_typology AND x.name_country = z.name_country
什麼是數據的所有行? brut table上的每一行在類型學和國家表上都有匹配的行嗎? – Kickstart
答案。恩,那就對了。 –
如果只執行SELECT部分會發生什麼? – jarlh