我想获取以下数据集:
Description ShortDescription Result
Actions to look for a job job_search_action Dont' look actively
Actions to look for a job job_search_action Drop off CV's
Actions to look for a job job_search_action Job ads
Actions to look for a job job_search_action N/A
并获得以下结果:
Description ShortDescription Result
Actions to look for a job job_search_action Don't look actively, Drop
off CV's, Job ads, N/A
biquery的任何帮助都没有listagg函数
答案 0 :(得分:1)
如果要使用类似列表的结构(数组),可以将STRING_AGG()
用于csv或ARRAY_AGG()
。然后Warning: Section [RegKeys] has no data
Warning: Section [DefaultInstall] key "AddReg" - there are no section entries to process
Error: CAB file "C:\VB2008PRO\Stock System v4.0.6764.19135\CABProject\Release\CABProject.CAB" could not be created
其他两列。
答案 1 :(得分:0)
with cte as (select 'Actions to look for a job' as Description, 'job_search_action' as ShortDescription, 'Dont\' look actively' as Result
union all
select 'Actions to look for a job' as Description, 'job_search_action' as ShortDescription, 'Drop off CV\'s' as Result
union all
select 'Actions to look for a job' as Description, 'job_search_action' as ShortDescription, 'Job ads' as Result
union all
select 'Actions to look for a job' as Description, 'job_search_action' as ShortDescription, 'N/A' as Result)
select Description, ShortDescription, string_agg(Result, ', ') from cte
group by 1,2
返回:
+-----+---------------------------+-------------------+--------------------------------------------------+--+
| Row | Description | ShortDescription | f0_ | |
+-----+---------------------------+-------------------+--------------------------------------------------+--+
| 1 | Actions to look for a job | job_search_action | Dont' look actively, Drop off CV's, Job ads, N/A | |
+-----+---------------------------+-------------------+--------------------------------------------------+--+