Google bigquery 如何从嵌套表BigQuery在嵌套表中插入数据

Google bigquery 如何从嵌套表BigQuery在嵌套表中插入数据,google-bigquery,Google Bigquery,我有两个嵌套的表,我想相互插入 我试试这个: INSERT INTO table1 ( record.id, record.product.type, record.product.price ) SELECT id product.type product.price FROM table 2 或者这个: INSERT INTO table1 ( record.id, record.product ) VALUES ( STRUCT((select id from tab

我有两个嵌套的表,我想相互插入

我试试这个:

INSERT INTO table1 ( record.id, record.product.type, record.product.price )
SELECT
 id
 product.type
 product.price
FROM table 2

或者这个:

INSERT INTO table1 ( record.id, record.product )
VALUES (
      STRUCT((select id from table2)),
      STRUCT((select product.type from table2))
  )
BQ警报:

Syntax error: Expected ")" or "," but got "." at [1:62] Learn More about BigQuery SQL Functions. 
但这不管用

表1

record                      RECORD  NULLABLE    
record.id                   STRING  NULLABLE    
record.product              RECORD  NULLABLE    
record.product.type         STRING  NULLABLE    
record.product.price        FLOAT   NULLABLE    
表2

id                      STRING  NULLABLE    
product                 RECORD  NULLABLE    
product.type            STRING  NULLABLE    
product.price           FLOAT   NULLABLE    

如何才能做到这一点?

您可以使用APPLY操作符取消对表格的分割 请访问此答案 您可以尝试以下方法:

INSERT INTO table1
SELECT STRUCT(id, STRUCT(productPrice.type, productPrice.price)) FROM table2;

如果有帮助,请考虑投票并接受这个答案!