运行以下查询后
SELECT ARRAY_TO_STRING( reporteeNames, '|') FROM
`appsflow-dev.PersonRequisition.ExternalNewHire`;
我遇到错误
架构图
Fieldname Type Mode
reporteeNames RECORD REPEATED
reporteeNames.reporteeTitle STRING NULLABLE
reporteeNames.reporteeName RECORD NULLABLE
reporteeNames.reporteeName.display STRING NULLABLE
reporteeNames.reporteeName.value STRING NULLABLE
请提供针对我的架构的解决方案。
最佳答案
您需要取消嵌套数组以选择结构内的字段:
SELECT
(SELECT STRING_AGG(reporteeName, '|')
FROM UNNEST(reporteeNames)) AS names
FROM `your-project`.dataset.table
另请参见working with arrays documentation。