google-bigquery - Bigquery - 重复字符串
问题描述
我 splat 一个字符串,现在我想使用输出,但我得到错误,因为split
考虑了 -output Repeated Sting
,因此ARRAY
.
我该如何解决它?
谢谢
With ex1 as (
SELECT 'test1,test2' as example
),
ex2 as (
SELECT 'test1' as str1, 5 as value)
SELECT *
from
(SELECT split(example,',') as strings
from ex1)
left join
ex2
on str1 = strings
解决方案
您需要 UNNEST 拆分的结果:
WITH
ex1 AS (
SELECT 'test1,test2' as example),
ex2 AS (
SELECT 'test1' as str1, 5 as value)
SELECT * from
(SELECT * FROM UNNEST((SELECT split(example) FROM ex1)) as strings)
left join
ex2
on str1 = strings
推荐阅读
- c - 在 C 中使用 printf 时出现奇怪的符号
- excel - 使用 VBA 将特定列从工作簿复制到另一个
- algorithm - 为什么在递归矩阵遍历算法中返回 0 或 1?
- open3d - 重叠点 Open3d
- java - 构建 Spring Boot 本机应用程序(Eclipse + Maven + GraalVM + native-image 插件)失败(找不到 cl.exe)
- c# - 更改文件夹名称后未加载 Visual Studio 项目
- pandas - 仅在从工作代码构建 .exe 时:AttributeError: Can only use .dt accessor with datetimelike values
- html - rvest 电子邮件在具有复杂节点结构(html 节点)的页面上抓取
- javascript - 如何动态重命名 href="" 或内部链接/url?
- linker - ldd 对一个文件说“未找到”,而对另一个文件说“未找到”