gpt4 book ai didi

sql - 逗号分隔值上的大查询连接

转载 作者:行者123 更新时间:2023-12-04 12:56:47 29 4
gpt4 key购买 nike

我在 BigTable 中有以下表结构。
enter image description here
enter image description here
我希望通过基于逗号值加入来低于输出。
enter image description here
MySQL 有 find_in_set做类似事情的函数,但我怎么能在bigquery中做呢?

最佳答案

考虑以下选项

#standardSQL
select id, product_name,
(select string_agg(category_name)
from unnest(split(categories)) as cat_id
join `project.dataset.categories`
on cat_id = cast(id as string)
) as categories
from `project.dataset.products`
对于您提供的样本数据 - 它返回
enter image description here

关于sql - 逗号分隔值上的大查询连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65721501/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com